├── .github ├── actions │ ├── benchmark │ │ └── action.yml │ ├── futhark-slurm │ │ └── action.yml │ └── is-slurm │ │ └── action.yml └── workflows │ ├── benchmark.yml │ ├── main.yml │ └── release.yml ├── .gitignore ├── .gitmodules ├── .hlint.yaml ├── .mailmap ├── .readthedocs.yaml ├── CHANGELOG.md ├── CITATION.cff ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── HACKING.md ├── LICENSE ├── Makefile ├── README.md ├── STYLE.md ├── Setup.hs ├── assets ├── logo.svg └── ohyes.png ├── cabal.project ├── default.nix ├── docs ├── .gitignore ├── Makefile ├── _theme │ └── futhark │ │ ├── static │ │ └── style.css │ │ └── theme.conf ├── binary-data-format.rst ├── c-api.rst ├── c-porting-guide.rst ├── conf.py ├── default.nix ├── error-index.rst ├── glossary.rst ├── index.rst ├── installation.rst ├── js-api.rst ├── language-reference.rst ├── man │ ├── futhark-autotune.rst │ ├── futhark-bench.rst │ ├── futhark-c.rst │ ├── futhark-cuda.rst │ ├── futhark-dataset.rst │ ├── futhark-doc.rst │ ├── futhark-fmt.rst │ ├── futhark-hip.rst │ ├── futhark-ispc.rst │ ├── futhark-literate.rst │ ├── futhark-multicore.rst │ ├── futhark-opencl.rst │ ├── futhark-pkg.rst │ ├── futhark-profile.rst │ ├── futhark-pyopencl.rst │ ├── futhark-python.rst │ ├── futhark-repl.rst │ ├── futhark-run.rst │ ├── futhark-script.rst │ ├── futhark-test.rst │ ├── futhark-wasm-multicore.rst │ ├── futhark-wasm.rst │ └── futhark.rst ├── manifest.schema.json ├── package-management.rst ├── performance.rst ├── report.schema.json ├── requirements.txt ├── server-protocol.rst ├── usage.rst └── versus-other-languages.rst ├── futhark.cabal ├── nix ├── elfutils191.nix ├── futhark-data.nix ├── futhark-manifest.nix ├── futhark-server.nix ├── sources.json ├── sources.nix └── zlib.nix ├── prelude ├── STYLE.md ├── ad.fut ├── array.fut ├── functional.fut ├── math.fut ├── prelude.fut ├── soacs.fut └── zip.fut ├── pyproject.toml ├── rts ├── README.md ├── c │ ├── STYLE.md │ ├── atomics16.h │ ├── atomics32.h │ ├── atomics64.h │ ├── atomics8.h │ ├── backends │ │ ├── c.h │ │ ├── cuda.h │ │ ├── hip.h │ │ ├── multicore.h │ │ └── opencl.h │ ├── cache.h │ ├── context.h │ ├── context_prototypes.h │ ├── copy.h │ ├── errors.h │ ├── event_list.h │ ├── free_list.h │ ├── gpu.h │ ├── gpu_prototypes.h │ ├── half.h │ ├── ispc_util.h │ ├── lock.h │ ├── scalar.h │ ├── scalar_f16.h │ ├── scheduler.h │ ├── server.h │ ├── timing.h │ ├── tuning.h │ ├── uniform.h │ ├── util.h │ └── values.h ├── cuda │ └── prelude.cu ├── futhark-doc │ └── style.css ├── javascript │ ├── server.js │ ├── values.js │ └── wrapperclasses.js ├── opencl │ ├── copy.cl │ ├── prelude.cl │ └── transpose.cl └── python │ ├── memory.py │ ├── opencl.py │ ├── panic.py │ ├── scalar.py │ ├── server.py │ ├── tuning.py │ └── values.py ├── setup.cfg ├── shell.nix ├── src-testing ├── Futhark │ ├── AD │ │ └── DerivativesTests.hs │ ├── Analysis │ │ ├── AlgSimplifyTests.hs │ │ └── PrimExp │ │ │ └── TableTests.hs │ ├── BenchTests.hs │ ├── IR │ │ ├── GPUTests.hs │ │ ├── MCTests.hs │ │ ├── Mem │ │ │ ├── IntervalTests.hs │ │ │ ├── IxFun │ │ │ │ └── Alg.hs │ │ │ ├── IxFunTests.hs │ │ │ └── IxFunWrapper.hs │ │ ├── Prop │ │ │ ├── RearrangeTests.hs │ │ │ └── ReshapeTests.hs │ │ ├── PropTests.hs │ │ ├── Syntax │ │ │ └── CoreTests.hs │ │ └── SyntaxTests.hs │ ├── Internalise │ │ └── TypesValuesTests.hs │ ├── Optimise │ │ ├── ArrayLayout │ │ │ ├── AnalyseTests.hs │ │ │ └── LayoutTests.hs │ │ ├── ArrayLayoutTests.hs │ │ └── MemoryBlockMerging │ │ │ └── GreedyColoringTests.hs │ ├── Pkg │ │ └── SolveTests.hs │ └── ProfileTests.hs ├── Language │ └── Futhark │ │ ├── CoreTests.hs │ │ ├── ParserBenchmarks.hs │ │ ├── PrettyTests.hs │ │ ├── PrimitiveTests.hs │ │ ├── SemanticTests.hs │ │ ├── SyntaxTests.hs │ │ ├── TypeChecker │ │ └── TypesTests.hs │ │ └── TypeCheckerTests.hs ├── futhark_benchmarks.hs └── futhark_tests.hs ├── src ├── Futhark.hs ├── Futhark │ ├── AD │ │ ├── Derivatives.hs │ │ ├── Fwd.hs │ │ ├── Rev.hs │ │ └── Rev │ │ │ ├── Hist.hs │ │ │ ├── Loop.hs │ │ │ ├── Map.hs │ │ │ ├── Monad.hs │ │ │ ├── Reduce.hs │ │ │ ├── SOAC.hs │ │ │ ├── Scan.hs │ │ │ └── Scatter.hs │ ├── Actions.hs │ ├── Analysis │ │ ├── AccessPattern.hs │ │ ├── AlgSimplify.hs │ │ ├── Alias.hs │ │ ├── CallGraph.hs │ │ ├── DataDependencies.hs │ │ ├── HORep │ │ │ ├── MapNest.hs │ │ │ └── SOAC.hs │ │ ├── Interference.hs │ │ ├── LastUse.hs │ │ ├── MemAlias.hs │ │ ├── Metrics.hs │ │ ├── Metrics │ │ │ └── Type.hs │ │ ├── PrimExp.hs │ │ ├── PrimExp │ │ │ ├── Convert.hs │ │ │ ├── Parse.hs │ │ │ ├── Simplify.hs │ │ │ └── Table.hs │ │ ├── SymbolTable.hs │ │ └── UsageTable.hs │ ├── Bench.hs │ ├── Builder.hs │ ├── Builder │ │ └── Class.hs │ ├── CLI │ │ ├── Autotune.hs │ │ ├── Bench.hs │ │ ├── Benchcmp.hs │ │ ├── C.hs │ │ ├── CUDA.hs │ │ ├── Check.hs │ │ ├── Datacmp.hs │ │ ├── Dataset.hs │ │ ├── Defs.hs │ │ ├── Dev.hs │ │ ├── Doc.hs │ │ ├── Eval.hs │ │ ├── Fmt.hs │ │ ├── HIP.hs │ │ ├── LSP.hs │ │ ├── Literate.hs │ │ ├── Main.hs │ │ ├── Misc.hs │ │ ├── Multicore.hs │ │ ├── MulticoreISPC.hs │ │ ├── MulticoreWASM.hs │ │ ├── OpenCL.hs │ │ ├── Pkg.hs │ │ ├── Profile.hs │ │ ├── PyOpenCL.hs │ │ ├── Python.hs │ │ ├── Query.hs │ │ ├── REPL.hs │ │ ├── Run.hs │ │ ├── Script.hs │ │ ├── Test.hs │ │ └── WASM.hs │ ├── CodeGen │ │ ├── Backends │ │ │ ├── CCUDA.hs │ │ │ ├── COpenCL.hs │ │ │ ├── GPU.hs │ │ │ ├── GenericC.hs │ │ │ ├── GenericC │ │ │ │ ├── CLI.hs │ │ │ │ ├── Code.hs │ │ │ │ ├── EntryPoints.hs │ │ │ │ ├── Fun.hs │ │ │ │ ├── Monad.hs │ │ │ │ ├── Options.hs │ │ │ │ ├── Pretty.hs │ │ │ │ ├── Server.hs │ │ │ │ └── Types.hs │ │ │ ├── GenericPython.hs │ │ │ ├── GenericPython │ │ │ │ ├── AST.hs │ │ │ │ └── Options.hs │ │ │ ├── GenericWASM.hs │ │ │ ├── HIP.hs │ │ │ ├── MulticoreC.hs │ │ │ ├── MulticoreC │ │ │ │ └── Boilerplate.hs │ │ │ ├── MulticoreISPC.hs │ │ │ ├── MulticoreWASM.hs │ │ │ ├── PyOpenCL.hs │ │ │ ├── PyOpenCL │ │ │ │ └── Boilerplate.hs │ │ │ ├── SequentialC.hs │ │ │ ├── SequentialC │ │ │ │ └── Boilerplate.hs │ │ │ ├── SequentialPython.hs │ │ │ ├── SequentialWASM.hs │ │ │ └── SimpleRep.hs │ │ ├── ImpCode.hs │ │ ├── ImpCode │ │ │ ├── GPU.hs │ │ │ ├── Multicore.hs │ │ │ ├── OpenCL.hs │ │ │ └── Sequential.hs │ │ ├── ImpGen.hs │ │ ├── ImpGen │ │ │ ├── CUDA.hs │ │ │ ├── GPU.hs │ │ │ ├── GPU │ │ │ │ ├── Base.hs │ │ │ │ ├── Block.hs │ │ │ │ ├── SegHist.hs │ │ │ │ ├── SegMap.hs │ │ │ │ ├── SegRed.hs │ │ │ │ ├── SegScan.hs │ │ │ │ ├── SegScan │ │ │ │ │ ├── SinglePass.hs │ │ │ │ │ └── TwoPass.hs │ │ │ │ └── ToOpenCL.hs │ │ │ ├── HIP.hs │ │ │ ├── Multicore.hs │ │ │ ├── Multicore │ │ │ │ ├── Base.hs │ │ │ │ ├── SegHist.hs │ │ │ │ ├── SegMap.hs │ │ │ │ ├── SegRed.hs │ │ │ │ └── SegScan.hs │ │ │ ├── OpenCL.hs │ │ │ └── Sequential.hs │ │ ├── OpenCL │ │ │ └── Heuristics.hs │ │ └── RTS │ │ │ ├── C.hs │ │ │ ├── CUDA.hs │ │ │ ├── JavaScript.hs │ │ │ ├── OpenCL.hs │ │ │ └── Python.hs │ ├── Compiler.hs │ ├── Compiler │ │ ├── CLI.hs │ │ ├── Config.hs │ │ └── Program.hs │ ├── Construct.hs │ ├── Doc │ │ └── Generator.hs │ ├── Error.hs │ ├── Fmt │ │ ├── Monad.hs │ │ └── Printer.hs │ ├── Format.hs │ ├── FreshNames.hs │ ├── IR.hs │ ├── IR │ │ ├── Aliases.hs │ │ ├── GPU.hs │ │ ├── GPU │ │ │ ├── Op.hs │ │ │ ├── Simplify.hs │ │ │ └── Sizes.hs │ │ ├── GPUMem.hs │ │ ├── MC.hs │ │ ├── MC │ │ │ └── Op.hs │ │ ├── MCMem.hs │ │ ├── Mem.hs │ │ ├── Mem │ │ │ ├── Interval.hs │ │ │ ├── LMAD.hs │ │ │ └── Simplify.hs │ │ ├── Parse.hs │ │ ├── Pretty.hs │ │ ├── Prop.hs │ │ ├── Prop │ │ │ ├── Aliases.hs │ │ │ ├── Constants.hs │ │ │ ├── Names.hs │ │ │ ├── Pat.hs │ │ │ ├── Rearrange.hs │ │ │ ├── Reshape.hs │ │ │ ├── Scope.hs │ │ │ ├── TypeOf.hs │ │ │ └── Types.hs │ │ ├── Rep.hs │ │ ├── Rephrase.hs │ │ ├── RetType.hs │ │ ├── SOACS.hs │ │ ├── SOACS │ │ │ ├── SOAC.hs │ │ │ └── Simplify.hs │ │ ├── SegOp.hs │ │ ├── Seq.hs │ │ ├── SeqMem.hs │ │ ├── Syntax.hs │ │ ├── Syntax │ │ │ └── Core.hs │ │ ├── Traversals.hs │ │ └── TypeCheck.hs │ ├── Internalise.hs │ ├── Internalise │ │ ├── AccurateSizes.hs │ │ ├── ApplyTypeAbbrs.hs │ │ ├── Bindings.hs │ │ ├── Defunctionalise.hs │ │ ├── Defunctorise.hs │ │ ├── Entry.hs │ │ ├── Exps.hs │ │ ├── FullNormalise.hs │ │ ├── Lambdas.hs │ │ ├── LiftLambdas.hs │ │ ├── Monad.hs │ │ ├── Monomorphise.hs │ │ ├── ReplaceRecords.hs │ │ └── TypesValues.hs │ ├── LSP │ │ ├── Compile.hs │ │ ├── Diagnostic.hs │ │ ├── Handlers.hs │ │ ├── PositionMapping.hs │ │ ├── State.hs │ │ └── Tool.hs │ ├── MonadFreshNames.hs │ ├── Optimise │ │ ├── ArrayLayout.hs │ │ ├── ArrayLayout │ │ │ ├── Layout.hs │ │ │ └── Transform.hs │ │ ├── ArrayShortCircuiting.hs │ │ ├── ArrayShortCircuiting │ │ │ ├── ArrayCoalescing.hs │ │ │ ├── DataStructs.hs │ │ │ ├── MemRefAggreg.hs │ │ │ └── TopdownAnalysis.hs │ │ ├── BlkRegTiling.hs │ │ ├── CSE.hs │ │ ├── DoubleBuffer.hs │ │ ├── EntryPointMem.hs │ │ ├── Fusion.hs │ │ ├── Fusion │ │ │ ├── Composing.hs │ │ │ ├── GraphRep.hs │ │ │ ├── RulesWithAccs.hs │ │ │ └── TryFusion.hs │ │ ├── GenRedOpt.hs │ │ ├── HistAccs.hs │ │ ├── InliningDeadFun.hs │ │ ├── MemoryBlockMerging.hs │ │ ├── MemoryBlockMerging │ │ │ └── GreedyColoring.hs │ │ ├── MergeGPUBodies.hs │ │ ├── ReduceDeviceSyncs.hs │ │ ├── ReduceDeviceSyncs │ │ │ ├── MigrationTable.hs │ │ │ └── MigrationTable │ │ │ │ └── Graph.hs │ │ ├── Simplify.hs │ │ ├── Simplify │ │ │ ├── Engine.hs │ │ │ ├── Rep.hs │ │ │ ├── Rule.hs │ │ │ ├── Rules.hs │ │ │ └── Rules │ │ │ │ ├── BasicOp.hs │ │ │ │ ├── ClosedForm.hs │ │ │ │ ├── Index.hs │ │ │ │ ├── Loop.hs │ │ │ │ ├── Match.hs │ │ │ │ └── Simple.hs │ │ ├── Sink.hs │ │ ├── TileLoops.hs │ │ ├── TileLoops │ │ │ └── Shared.hs │ │ └── Unstream.hs │ ├── Pass.hs │ ├── Pass │ │ ├── AD.hs │ │ ├── ExpandAllocations.hs │ │ ├── ExplicitAllocations.hs │ │ ├── ExplicitAllocations │ │ │ ├── GPU.hs │ │ │ ├── MC.hs │ │ │ ├── SegOp.hs │ │ │ └── Seq.hs │ │ ├── ExtractKernels.hs │ │ ├── ExtractKernels │ │ │ ├── BlockedKernel.hs │ │ │ ├── DistributeNests.hs │ │ │ ├── Distribution.hs │ │ │ ├── ISRWIM.hs │ │ │ ├── Interchange.hs │ │ │ ├── Intrablock.hs │ │ │ ├── StreamKernel.hs │ │ │ └── ToGPU.hs │ │ ├── ExtractMulticore.hs │ │ ├── FirstOrderTransform.hs │ │ ├── LiftAllocations.hs │ │ ├── LowerAllocations.hs │ │ └── Simplify.hs │ ├── Passes.hs │ ├── Pipeline.hs │ ├── Pkg │ │ ├── Info.hs │ │ ├── Solve.hs │ │ └── Types.hs │ ├── Profile.hs │ ├── Script.hs │ ├── Test.hs │ ├── Test │ │ ├── Spec.hs │ │ └── Values.hs │ ├── Tools.hs │ ├── Transform │ │ ├── CopyPropagate.hs │ │ ├── FirstOrderTransform.hs │ │ ├── Rename.hs │ │ └── Substitute.hs │ ├── Util.hs │ ├── Util │ │ ├── CMath.hs │ │ ├── IntegralExp.hs │ │ ├── Loc.hs │ │ ├── Log.hs │ │ ├── Options.hs │ │ ├── Pretty.hs │ │ ├── ProgressBar.hs │ │ └── Table.hs │ └── Version.hs ├── Language │ ├── Futhark.hs │ └── Futhark │ │ ├── Core.hs │ │ ├── FreeVars.hs │ │ ├── Interpreter.hs │ │ ├── Interpreter │ │ ├── AD.hs │ │ └── Values.hs │ │ ├── Parser.hs │ │ ├── Parser │ │ ├── Lexer.x │ │ ├── Lexer │ │ │ ├── Tokens.hs │ │ │ └── Wrapper.hs │ │ ├── Monad.hs │ │ └── Parser.y │ │ ├── Prelude.hs │ │ ├── Pretty.hs │ │ ├── Primitive.hs │ │ ├── Primitive │ │ └── Parse.hs │ │ ├── Prop.hs │ │ ├── Query.hs │ │ ├── Semantic.hs │ │ ├── Syntax.hs │ │ ├── Traversals.hs │ │ ├── Tuple.hs │ │ ├── TypeChecker.hs │ │ ├── TypeChecker │ │ ├── Consumption.hs │ │ ├── Match.hs │ │ ├── Modules.hs │ │ ├── Monad.hs │ │ ├── Names.hs │ │ ├── Terms.hs │ │ ├── Terms │ │ │ ├── Loop.hs │ │ │ ├── Monad.hs │ │ │ └── Pat.hs │ │ ├── Types.hs │ │ └── Unify.hs │ │ └── Warnings.hs └── main.hs ├── tests ├── .gitignore ├── BabyBearFun.fut ├── BabyBearImp.fut ├── README.md ├── accs │ ├── dup.fut │ ├── fusion0.fut │ ├── hist0.fut │ ├── hist1.fut │ ├── hist2.fut │ ├── hist3.fut │ ├── hist4.fut │ ├── hist5.fut │ ├── id.fut │ ├── intrinsics.fut │ ├── neutral.fut │ ├── outermap0.fut │ ├── scatter0.fut │ ├── scatter1.fut │ ├── scatter2.fut │ └── scatterhist.fut ├── ad │ ├── arr0.fut │ ├── arr1.fut │ ├── arr2.fut │ ├── cert.fut │ ├── clz.fut │ ├── cmp0.fut │ ├── concat0.fut │ ├── confusion0.fut │ ├── consume0.fut │ ├── consume1.fut │ ├── consume2.fut │ ├── consume3.fut │ ├── consume4.fut │ ├── consume5.fut │ ├── consume6.fut │ ├── conv0.fut │ ├── conv1.fut │ ├── fadd.fut │ ├── fdiv.fut │ ├── fmul.fut │ ├── for0.fut │ ├── for1.fut │ ├── for2.fut │ ├── for3.fut │ ├── fwd │ │ ├── acc0.fut │ │ ├── for0.fut │ │ ├── for1.fut │ │ ├── map0.fut │ │ ├── red0.fut │ │ ├── scatter0.fut │ │ └── while0.fut │ ├── gather0.fut │ ├── gather1.fut │ ├── gather2.fut │ ├── genred-opt │ │ ├── bfast-mmm.fut │ │ ├── gemm-simple.fut │ │ ├── lud-mmm.fut │ │ ├── matmul-simple.fut │ │ ├── matmul.fut │ │ └── matvec-simple.fut │ ├── if0.fut │ ├── if1.fut │ ├── if2.fut │ ├── imul.fut │ ├── iota0.fut │ ├── isnan.fut │ ├── issue1473.fut │ ├── issue1564.fut │ ├── issue1577.fut │ ├── issue1604.fut │ ├── issue1613.fut │ ├── issue1879.fut │ ├── issue2199.fut │ ├── issue2228.fut │ ├── issue2229_jvp.fut │ ├── issue2229_vjp.fut │ ├── issue2239.fut │ ├── issue2256.fut │ ├── kmeans-cost-rev.fut │ ├── lighthouse.fut │ ├── lotka_volterra.fut │ ├── map0.fut │ ├── map1.fut │ ├── map2.fut │ ├── map3.fut │ ├── map4.fut │ ├── map5.fut │ ├── map6.fut │ ├── map7.fut │ ├── matmul.fut │ ├── maximum.fut │ ├── minimum.fut │ ├── minmax.fut │ ├── negate.fut │ ├── nested0.fut │ ├── nested1.fut │ ├── nested2.fut │ ├── nested3.fut │ ├── nested4.fut │ ├── not.fut │ ├── pow0.fut │ ├── rearrange0.fut │ ├── reduce-vec-minmax0.fut │ ├── reduce0.fut │ ├── reduce1.fut │ ├── reduce2.fut │ ├── reduce_by_index0.fut │ ├── reducebyindex0.fut │ ├── reducebyindex1.fut │ ├── reducebyindex2.fut │ ├── reducebyindex3.fut │ ├── reducebyindex4.fut │ ├── reducebyindex5.fut │ ├── reducebyindex6.fut │ ├── reducebyindexadd0.fut │ ├── reducebyindexadd1.fut │ ├── reducebyindexadd2.fut │ ├── reducebyindexadd3.fut │ ├── reducebyindexadd4.fut │ ├── reducebyindexgenbenchtests.fut │ ├── reducebyindexminmax0.fut │ ├── reducebyindexminmax1.fut │ ├── reducebyindexminmax10.fut │ ├── reducebyindexminmax2.fut │ ├── reducebyindexminmax3.fut │ ├── reducebyindexminmax4.fut │ ├── reducebyindexminmax5.fut │ ├── reducebyindexminmax6.fut │ ├── reducebyindexminmax7.fut │ ├── reducebyindexminmax8.fut │ ├── reducebyindexminmax9.fut │ ├── reducebyindexmul0.fut │ ├── reducebyindexmul1.fut │ ├── reducebyindexmul2.fut │ ├── reducebyindexmul3.fut │ ├── reducebyindexmul4.fut │ ├── reducebyindexspbenchtests.fut │ ├── reducebyindexvecmin0.fut │ ├── reducebyindexvecmul0.fut │ ├── reducemul0.fut │ ├── reducemul1.fut │ ├── reducemul2.fut │ ├── reducemul3.fut │ ├── reducemul4.fut │ ├── reducevec0.fut │ ├── reducevecmul0.fut │ ├── reducevecmul1.fut │ ├── reducevecmul2.fut │ ├── reducevecmul3.fut │ ├── replicate0.fut │ ├── replicate1.fut │ ├── replicate2.fut │ ├── reshape0.fut │ ├── rev_const.fut │ ├── rev_unused.fut │ ├── rotate0.fut │ ├── scan0.fut │ ├── scan1.fut │ ├── scan2.fut │ ├── scan3.fut │ ├── scan4.fut │ ├── scan5.fut │ ├── scan6.fut │ ├── scan7.fut │ ├── scan8.fut │ ├── scan9.fut │ ├── scangenbenchtests.fut │ ├── scanvecbenchtests.fut │ ├── scatter0.fut │ ├── scatter1.fut │ ├── sdf.fut │ ├── stripmine0.fut │ ├── stripmine1.fut │ ├── stripmine2.fut │ ├── stripmine3.fut │ ├── sum.fut │ ├── truedep0.fut │ ├── truedep1.fut │ ├── while0.fut │ └── while1.fut ├── allocs.fut ├── american_option.fut ├── apply-or-index.fut ├── array14-running-example.fut ├── arrayInTupleArray.fut ├── arraylit.fut ├── arraylit1.fut ├── arraylit2.fut ├── arraylit3.fut ├── arraylit4.fut ├── ascription0.fut ├── ascription1.fut ├── ascription2.fut ├── ascription3.fut ├── ascription4.fut ├── assert0.fut ├── assert1.fut ├── assert2.fut ├── assert3.fut ├── assert4.fut ├── attributes │ ├── blank.fut │ ├── noinline0.fut │ ├── noinline1.fut │ ├── noinline2.fut │ ├── num0.fut │ ├── params0.fut │ ├── params1.fut │ ├── scratch.fut │ ├── sequential0.fut │ ├── sequential1.fut │ ├── sequential2.fut │ ├── sequential_inner0.fut │ ├── sequential_inner1.fut │ ├── sequential_outer0.fut │ ├── sequential_outer1.fut │ ├── unroll0.fut │ ├── unroll1.fut │ ├── unroll2.fut │ ├── unroll3.fut │ ├── unsafe0.fut │ ├── unsafe1.fut │ ├── unsafe2.fut │ ├── warn_on_safety_checks0.fut │ ├── warn_on_safety_checks1.fut │ └── warn_on_safety_checks2.fut ├── babysitter │ ├── no-manifest-1.fut │ └── no-manifest-2.fut ├── backtick.fut ├── bad-reduce.fut ├── bad_names.fut ├── badentry10.fut ├── badentry2.fut ├── badentry3.fut ├── badentry4.fut ├── badentry8.fut ├── badentry9.fut ├── big0.fut ├── big1.fut ├── big2.fut ├── binding-warn0.fut ├── binding-warn1.fut ├── bitwise.fut ├── blackscholes.fut ├── bounds-elim0.fut ├── bounds-elim1.fut ├── bounds-elim2.fut ├── bounds-error0.fut ├── bounds-error1.fut ├── branch_array.fut ├── closedform_loop.fut ├── coalescing │ ├── coalescing1.fut │ ├── coalescing2.fut │ ├── coalescing3.fut │ └── coalescing4.fut ├── collision.fut ├── complement.fut ├── concat.fut ├── concat1.fut ├── concat10.fut ├── concat11.fut ├── concat12.fut ├── concat2.fut ├── concat3.fut ├── concat4.fut ├── concat7.fut ├── concat8.fut ├── concat9.fut ├── constant_folding0.fut ├── constants │ ├── const0-error.fut │ ├── const0.fut │ ├── const1.fut │ ├── const2.fut │ ├── const3.fut │ ├── const4.fut │ ├── const5.fut │ ├── const6.fut │ ├── const7.fut │ ├── const8.fut │ └── const9.fut ├── convert_id.fut ├── copy-manifest.fut ├── copyPropTest1.fut ├── copyPropTest2.fut ├── copyPropTest3.fut ├── cse0.fut ├── curry0.fut ├── curry1.fut ├── curry2.fut ├── deadCodeElimTest1.fut ├── deadCodeElimTest2.fut ├── dependence-analysis │ ├── ad_acc.fut │ ├── hist0.fut │ ├── hist1.fut │ ├── jvp0.fut │ ├── map0.fut │ ├── reduce0.fut │ ├── scan0.fut │ ├── scan1.fut │ ├── scatter0.fut │ └── vjp0.fut ├── distribution │ ├── branch0.fut │ ├── distribution0.fut │ ├── distribution1.fut │ ├── distribution10.fut │ ├── distribution11.fut │ ├── distribution12.fut │ ├── distribution2.fut │ ├── distribution3.fut │ ├── distribution3.fut.tuning │ ├── distribution4.fut │ ├── distribution5.fut │ ├── distribution6.fut │ ├── distribution8.fut │ ├── distribution9.fut │ ├── gather0.fut │ ├── icfp16-example.fut │ ├── inplace0.fut │ ├── inplace1.fut │ ├── inplace2.fut │ ├── inplace3.fut │ ├── inplace4.fut │ ├── inplace5.fut │ ├── inplace6.fut │ ├── inplace7.fut │ ├── irregular0.fut │ ├── irwim0.fut │ ├── loop0.fut │ ├── loop1.fut │ ├── loop2.fut │ ├── loop3.fut │ ├── loop4.fut │ ├── loop5.fut │ ├── loop6.fut │ ├── loop7.fut │ ├── map-duplicate.fut │ ├── map-replicate.fut │ ├── redomap0.fut │ ├── scatter0.fut │ ├── scatter1.fut │ ├── scatter2.fut │ ├── scatter3.fut │ ├── segconcat0.fut │ ├── segconcat1.fut │ ├── segconcat2.fut │ ├── segreduce0.fut │ ├── segreduce1.fut │ └── segscan0.fut ├── doublebuffer.fut ├── entrycopy0.fut ├── entrycopy1.fut ├── entryexpr.fut ├── entryval.fut ├── enums │ ├── enum0.fut │ ├── enum1.fut │ ├── enum10.fut │ ├── enum11.fut │ ├── enum12.fut │ ├── enum13.fut │ ├── enum14.fut │ ├── enum15.fut │ ├── enum16.fut │ ├── enum17.fut │ ├── enum18.fut │ ├── enum19.fut │ ├── enum2.fut │ ├── enum20.fut │ ├── enum21.fut │ ├── enum22.fut │ ├── enum23.fut │ ├── enum24.fut │ ├── enum25.fut │ ├── enum26.fut │ ├── enum27.fut │ ├── enum28.fut │ ├── enum29.fut │ ├── enum3.fut │ ├── enum30.fut │ ├── enum31.fut │ ├── enum32.fut │ ├── enum33.fut │ ├── enum34.fut │ ├── enum35.fut │ ├── enum36.fut │ ├── enum37.fut │ ├── enum38.fut │ ├── enum39.fut │ ├── enum4.fut │ ├── enum40.fut │ ├── enum41.fut │ ├── enum42.fut │ ├── enum43.fut │ ├── enum44.fut │ ├── enum45.fut │ ├── enum46.fut │ ├── enum47.fut │ ├── enum5.fut │ ├── enum6.fut │ ├── enum7.fut │ ├── enum8.fut │ ├── enum9.fut │ └── issue663.fut ├── eqarrays0.fut ├── eqarrays1.fut ├── errors │ ├── duplicate-let-size.fut │ ├── duplicate-params.fut │ ├── duplicate-size-params.fut │ ├── duplicate-type-params.fut │ ├── duplicate-vars.fut │ ├── missing-in.fut │ ├── shadowed-function.fut │ ├── tuple-pattern.fut │ └── underscore-use.fut ├── euler │ ├── euler1.fut │ └── euler2.fut ├── existential-ifs │ ├── iota.fut │ ├── ixfun-antiunif-1.fut │ ├── ixfun-antiunif-2.fut │ ├── ixfun-antiunif-5.fut │ ├── loop-antiunif.fut │ ├── merge_sort.fut │ ├── merge_sort_minimized.fut │ ├── no-ext.fut │ ├── partition.fut │ ├── two-exts.fut │ └── two-returns.fut ├── existential-loop │ └── slice.fut ├── f16kernel.fut ├── fibfun.fut ├── fibloop.fut ├── flattening │ ├── CosminArrayExample.fut │ ├── HighlyNestedMap.fut │ ├── IntmRes1.fut │ ├── IntmRes2.fut │ ├── IntmRes3.fut │ ├── LoopInv1.fut │ ├── LoopInv2.fut │ ├── LoopInv3.fut │ ├── LoopInvReshape.fut │ ├── Map-IotaMapReduce.fut │ ├── Map-Map-IotaMapReduce.fut │ ├── MapIotaReduce.fut │ ├── MatrixAddition.fut │ ├── SimpleReduce.fut │ ├── VectorAddition.fut │ ├── flattening-pipeline │ ├── flattening-test │ ├── map-nested-free.fut │ ├── redomap1.fut │ └── redomap2.fut ├── float_32_64.fut ├── floatunderscores.fut ├── fourier.fut ├── funcall-error0.fut ├── funcall-error1.fut ├── fusion │ ├── Vers2.0 │ │ ├── bugCalib.fut │ │ ├── hindrReshape0.fut │ │ ├── mapomap0.fut │ │ ├── mapomap1.fut │ │ ├── mapored0.fut │ │ ├── mapored1.fut │ │ ├── maposcan0.fut │ │ ├── maposcanomaposcan.fut │ │ ├── rangeIndVar.fut │ │ ├── redomap0.fut │ │ ├── redomap1.fut │ │ └── redoredomapomap0.fut │ ├── WithAccs │ │ ├── ker2-radix.fut │ │ ├── map-flat-scat-0.fut │ │ ├── map-flat-scat-1.fut │ │ ├── map-flat-scat-2.fut │ │ ├── map-flat-scat-3.fut │ │ ├── map-wacc-1.fut │ │ ├── map-wacc-map-wacc.fut │ │ └── wacc-map-1.fut │ ├── consumption0.fut │ ├── consumption1.fut │ ├── consumption2.fut │ ├── consumption3.fut │ ├── filter-filter1.fut │ ├── fuse-across-reshape-transpose.fut │ ├── fuse-across-reshape1.fut │ ├── fuse-across-reshape2.fut │ ├── fuse-across-reshape3.fut │ ├── fuse-across-reshape4.fut │ ├── fuse-across-reshape5.fut │ ├── fuse-across-reshape6.fut │ ├── fuse-across-transpose1.fut │ ├── fuse-across-transpose2.fut │ ├── fuse-across-transpose3.fut │ ├── fuse-across-transpose4.fut │ ├── fuse-across-transpose5.fut │ ├── fuse-across-transpose6.fut │ ├── fuse-across-transpose7.fut │ ├── fuseComplex1.fut │ ├── fuseEasy1.fut │ ├── fuseEasy2.fut │ ├── fuseEasy3.fut │ ├── fuseEasy4.fut │ ├── fuseFilter1.fut │ ├── fuseFilter2.fut │ ├── fusion1.fut │ ├── fusion2.fut │ ├── fusion3.fut │ ├── fusion4.fut │ ├── fusion5.fut │ ├── fusion6.fut │ ├── fusion7.fut │ ├── horizontal0.fut │ ├── iswim1.fut │ ├── iswim2.fut │ ├── iswim3.fut │ ├── map-scan1.fut │ ├── map-scan2.fut │ ├── map-scan3.fut │ ├── map-scatter-map.fut │ ├── noFusion1.fut │ ├── noFusion2.fut │ ├── noFusion3.fut │ ├── noFusion4.fut │ ├── red-red-fusion.fut │ ├── scanomap-scanomap1.fut │ ├── scanomap-scanomap2.fut │ ├── scanreduce0.fut │ ├── scanreduce1.fut │ ├── scatter-not-fuse.fut │ ├── scatter-o-maps.fut │ ├── slicemap0.fut │ ├── slicemap1.fut │ ├── slicemap2.fut │ ├── slicemap3.fut │ ├── slicemap4.fut │ ├── tabulate0.fut │ ├── tabulate1.fut │ └── tabulate2.fut ├── futlib_tests │ ├── array.fut │ └── math.fut ├── gauss_jordan.fut ├── globalsize0.fut ├── gregorian.fut ├── guysteele_sequential.fut ├── hexfloats.fut ├── higher-order-functions │ ├── alias0.fut │ ├── alias1.fut │ ├── alias2.fut │ ├── alias3.fut │ ├── array-fun0.fut │ ├── array-fun1.fut │ ├── array-fun2.fut │ ├── array-lambda0.fut │ ├── array-lambda1.fut │ ├── binop0.fut │ ├── binop1.fut │ ├── binop2.fut │ ├── conditional-function0.fut │ ├── function-argument0.fut │ ├── function-argument1.fut │ ├── function-argument2.fut │ ├── function-composition.fut │ ├── function-result0.fut │ ├── higher-order-entry-point0.fut │ ├── higher-order-entry-point1.fut │ ├── higher-order-entry-point2.fut │ ├── higher-order0.fut │ ├── higher-order1.fut │ ├── issue1798.fut │ ├── issue493.fut │ ├── localfunction0.fut │ ├── loops0.fut │ ├── match-function0.fut │ ├── nested-closures0.fut │ ├── partial-application0.fut │ ├── partial-application1.fut │ ├── records0.fut │ ├── records1.fut │ ├── shape-params0.fut │ ├── shape-params1.fut │ ├── shape-params2.fut │ ├── shape-params3.fut │ ├── shape-params4.fut │ ├── shape-params5.fut │ ├── shape-params6.fut │ ├── shape-params7.fut │ ├── soac0.fut │ ├── soac1.fut │ ├── uniqueness0.fut │ ├── uniqueness1.fut │ ├── uniqueness10.fut │ ├── uniqueness11.fut │ ├── uniqueness2.fut │ ├── uniqueness3.fut │ ├── uniqueness4.fut │ ├── uniqueness5.fut │ ├── uniqueness6.fut │ ├── uniqueness7.fut │ ├── uniqueness8.fut │ ├── uniqueness9.fut │ ├── value-type-function0.fut │ ├── value-type-function1.fut │ ├── value-type-function2.fut │ ├── value-type-function3.fut │ ├── value-type-function4.fut │ └── value-type-function5.fut ├── hist │ ├── and.fut │ ├── and16.fut │ ├── and64.fut │ ├── and8.fut │ ├── array.fut │ ├── array_novec.fut │ ├── equiv.fut │ ├── f16.fut │ ├── f32.fut │ ├── f64.fut │ ├── fusion.fut │ ├── hist2d.fut │ ├── hist3d.fut │ ├── horizontal-fusion.fut │ ├── i16.fut │ ├── i8.fut │ ├── large.fut │ ├── large2d.fut │ ├── max.fut │ ├── max16.fut │ ├── max64.fut │ ├── max8.fut │ ├── min.fut │ ├── min16.fut │ ├── min8.fut │ ├── or.fut │ ├── or16.fut │ ├── or8.fut │ ├── segmented.fut │ ├── segmented_2d.fut │ ├── segmented_arr.fut │ ├── simple.fut │ ├── tuple.fut │ ├── tuple_partial.fut │ ├── xor.fut │ ├── xor16.fut │ ├── xor64.fut │ └── xor8.fut ├── hoist-consume.fut ├── hoist-map.fut ├── hoist-unsafe.fut ├── hoist-unsafe2.fut ├── holes │ ├── hof0.fut │ ├── hof1.fut │ ├── hof2.fut │ ├── hof3.fut │ ├── loop0.fut │ ├── loop1.fut │ ├── loop2.fut │ ├── simple0.fut │ ├── simple1.fut │ ├── simple2.fut │ ├── simple3.fut │ ├── simple4.fut │ ├── simple5.fut │ └── simple6.fut ├── if0.fut ├── if1.fut ├── implicit_method.fut ├── in-place-distribute.fut ├── include_basic.fut ├── include_basic_includee.fut ├── include_many.fut ├── include_many_includee0.fut ├── include_many_includee0_includee.fut ├── include_many_includee1.fut ├── index0.fut ├── index1.fut ├── index10.fut ├── index11.fut ├── index12.fut ├── index13.fut ├── index14.fut ├── index2.fut ├── index4.fut ├── index5.fut ├── index6.fut ├── index7.fut ├── index8.fut ├── index9.fut ├── inlineTest1.fut ├── inplace-replicate.fut ├── inplace0.fut ├── inplace1.fut ├── inplace2.fut ├── inplace3.fut ├── inplace4.fut ├── inplace5.fut ├── inplace6.fut ├── int.fut ├── intragroup │ ├── big0.fut │ ├── complex-screma.fut │ ├── expansion0.fut │ ├── if0.fut │ ├── inplace0.fut │ ├── reduce0.fut │ ├── reduce1.fut │ ├── reduce1.fut.tuning │ ├── reduce2.fut │ ├── reduce2.fut.tuning │ ├── reduce3.fut │ ├── reduce4.fut │ ├── reduce_by_index0.fut │ ├── reduce_by_index1.fut │ ├── reduce_by_index2.fut │ ├── replicate0.fut │ ├── replicate0.fut.tuning │ ├── replicate1.fut │ ├── replicate1.fut.tuning │ ├── scan0.fut │ ├── scan0.fut.tuning │ ├── scan1.fut │ ├── scan1.fut.tuning │ ├── scan2.fut │ ├── scan2.fut.tuning │ ├── scan3.fut │ ├── scatter0.fut │ ├── segreduce0.fut │ ├── segreduce0.fut.tuning │ ├── segreduce1.fut │ ├── segreduce1.fut.tuning │ ├── segreduce2.fut │ ├── segreduce2.fut.tuning │ ├── segscan0.fut │ ├── segscan1.fut │ ├── segscan2.fut │ ├── stencil_1d.fut │ ├── stencil_1d.fut.tuning │ ├── stencil_2d.fut │ ├── stencil_2d.fut.tuning │ ├── toomuch.fut │ └── toomuch.fut.tuning ├── intunderscores.fut ├── iota0.fut ├── ipl-bug.fut ├── issue1025.fut ├── issue1043.fut ├── issue1053.fut ├── issue1054.fut ├── issue1068.fut ├── issue1069.fut ├── issue1073.fut ├── issue1074.fut ├── issue1080.fut ├── issue1100.fut ├── issue1112.fut ├── issue1139.fut ├── issue1142.fut ├── issue1143.fut ├── issue1153.fut ├── issue1155.fut ├── issue1168.fut ├── issue1173.fut ├── issue1174.fut ├── issue1177.fut ├── issue1192.fut ├── issue1194.fut ├── issue1203.fut ├── issue1209.fut ├── issue1213.fut ├── issue1222.fut ├── issue1223.fut ├── issue1225.fut ├── issue1231.fut ├── issue1232.fut ├── issue1237.fut ├── issue1239.fut ├── issue1240.fut ├── issue1241.fut ├── issue1242.fut ├── issue1243.fut ├── issue1250.fut ├── issue1262.fut ├── issue1268.fut ├── issue1284.fut ├── issue1291.fut ├── issue1292.fut ├── issue1294.fut ├── issue1296.fut ├── issue1302.fut ├── issue1310.fut ├── issue1322.fut ├── issue1325.fut ├── issue1326.fut ├── issue1328.fut ├── issue1332.fut ├── issue1333.fut ├── issue1345.fut ├── issue1350.fut ├── issue1358.fut ├── issue1366.fut ├── issue1384.fut ├── issue1424.fut ├── issue1424_tiny.fut ├── issue1435.fut ├── issue1455.fut ├── issue1457.fut ├── issue1462.fut ├── issue1476.fut ├── issue1478.fut ├── issue1481.fut ├── issue1492.fut ├── issue1498.fut ├── issue1499.fut ├── issue1500.fut ├── issue1501.fut ├── issue1505.fut ├── issue1510.fut ├── issue1512.fut ├── issue1523.fut ├── issue1524.fut ├── issue1525.fut ├── issue1531.fut ├── issue1533.fut ├── issue1535.fut ├── issue1537.fut ├── issue1545.fut ├── issue1546.fut ├── issue1552.fut ├── issue1553.fut ├── issue1557.fut ├── issue1559.fut ├── issue1569.fut ├── issue1572.fut ├── issue1579.fut ├── issue1593.fut ├── issue1599.fut ├── issue1609.fut ├── issue1610.fut ├── issue1615.fut ├── issue1627.fut ├── issue1628.fut ├── issue1631.fut ├── issue1653.fut ├── issue1669.fut ├── issue1685.fut ├── issue1700.fut ├── issue1711.fut ├── issue1739.fut ├── issue1741.fut ├── issue1744.fut ├── issue1749.fut ├── issue1753.fut ├── issue1755.fut ├── issue1757.fut ├── issue1758.fut ├── issue1774.fut ├── issue1780.fut ├── issue1783.fut ├── issue1787.fut ├── issue1791.fut ├── issue1794.fut ├── issue1806.fut ├── issue1808.fut ├── issue1816.fut ├── issue1824.fut ├── issue1837.fut ├── issue1838.fut ├── issue1841.fut ├── issue1843.fut ├── issue1847.fut ├── issue1853.fut ├── issue1855.fut ├── issue1863.fut ├── issue1874.fut ├── issue1895.fut ├── issue1903.fut ├── issue1926.fut ├── issue1935.fut ├── issue1936.fut ├── issue1937.fut ├── issue194.fut ├── issue1943.fut ├── issue1947.fut ├── issue1949.fut ├── issue1952.fut ├── issue1978.fut ├── issue1984.fut ├── issue1998.fut ├── issue2000.fut ├── issue2011.fut ├── issue2015.fut ├── issue2016.fut ├── issue2017.fut ├── issue2018.fut ├── issue2021.fut ├── issue2038.fut ├── issue2040.fut ├── issue2048.fut ├── issue2053.fut ├── issue2058.fut ├── issue2073.fut ├── issue2092.fut ├── issue2096.fut ├── issue2099.fut ├── issue2100.fut ├── issue2103.fut ├── issue2104.fut ├── issue2106.fut ├── issue2113.fut ├── issue2114.fut ├── issue2124.fut ├── issue2125.fut ├── issue2136.fut ├── issue2184.fut ├── issue2193.fut ├── issue2197.fut ├── issue2209.fut ├── issue2216.fut ├── issue2219.fut ├── issue2231_a.fut ├── issue2231_b.fut ├── issue2232.fut ├── issue2234.fut ├── issue2236.fut ├── issue2238.fut ├── issue2253.fut ├── issue2258.fut ├── issue2271.fut ├── issue2273.fut ├── issue2276.fut ├── issue245.fut ├── issue246.fut ├── issue248.fut ├── issue304.fut ├── issue354.fut ├── issue367.fut ├── issue390.fut ├── issue392.fut ├── issue393.fut ├── issue396.fut ├── issue397.fut ├── issue400.fut ├── issue403.fut ├── issue407.fut ├── issue408.fut ├── issue410.fut ├── issue413.fut ├── issue419.fut ├── issue426.fut ├── issue431.fut ├── issue433.fut ├── issue436.fut ├── issue437.fut ├── issue455.fut ├── issue456.fut ├── issue460.fut ├── issue473.fut ├── issue481.fut ├── issue483.fut ├── issue485.fut ├── issue506.fut ├── issue512.fut ├── issue514.fut ├── issue522.fut ├── issue525.fut ├── issue526.fut ├── issue527.fut ├── issue531.fut ├── issue538.fut ├── issue541.fut ├── issue544.fut ├── issue545.fut ├── issue553.fut ├── issue558.fut ├── issue560.fut ├── issue561.fut ├── issue567.fut ├── issue572.fut ├── issue573.fut ├── issue582.fut ├── issue589.fut ├── issue593.fut ├── issue596.fut ├── issue604.fut ├── issue605.fut ├── issue608.fut ├── issue622.fut ├── issue624.fut ├── issue626.fut ├── issue627.fut ├── issue643.fut ├── issue649.fut ├── issue656.fut ├── issue661.fut ├── issue667.fut ├── issue672.fut ├── issue679.fut ├── issue680.fut ├── issue681.fut ├── issue682.fut ├── issue706.fut ├── issue708.fut ├── issue709.fut ├── issue712.fut ├── issue715.fut ├── issue728.fut ├── issue743.fut ├── issue750.fut ├── issue762.fut ├── issue763.fut ├── issue767.fut ├── issue774.fut ├── issue780.fut ├── issue782.fut ├── issue793.fut ├── issue795.fut ├── issue798.fut ├── issue811.fut ├── issue812.fut ├── issue813.fut ├── issue814.fut ├── issue815.fut ├── issue816.fut ├── issue825.fut ├── issue826.fut ├── issue829.fut ├── issue844.fut ├── issue845.fut ├── issue847.fut ├── issue848.fut ├── issue869.fut ├── issue872.fut ├── issue873.fut ├── issue879.fut ├── issue880.fut ├── issue895.fut ├── issue921.fut ├── issue931.fut ├── issue941.fut ├── issue942.fut ├── issue992.fut ├── issue995.fut ├── linear_solve.fut ├── localfunction0.fut ├── localfunction1.fut ├── localfunction10.fut ├── localfunction11.fut ├── localfunction12.fut ├── localfunction2.fut ├── localfunction3.fut ├── localfunction4.fut ├── localfunction5.fut ├── localfunction6.fut ├── localfunction7.fut ├── localfunction8.fut ├── localfunction9.fut ├── loops │ ├── for-in0.fut │ ├── for-in1.fut │ ├── for-in2.fut │ ├── for-in3.fut │ ├── for-in4.fut │ ├── loop-error0.fut │ ├── loop0.fut │ ├── loop1.fut │ ├── loop10.fut │ ├── loop11.fut │ ├── loop12.fut │ ├── loop13.fut │ ├── loop14.fut │ ├── loop15.fut │ ├── loop16.fut │ ├── loop18.fut │ ├── loop2.fut │ ├── loop3.fut │ ├── loop4.fut │ ├── loop5.fut │ ├── loop6.fut │ ├── loop7.fut │ ├── loop8.fut │ ├── loop9.fut │ ├── pow2reduce.fut │ ├── while-loop0.fut │ ├── while-loop1.fut │ ├── while-loop2.fut │ └── while-loop3.fut ├── lss.fut ├── lu-factorisation.fut ├── man │ ├── bench │ │ └── example1.fut │ └── test │ │ ├── example1.fut │ │ ├── example2.fut │ │ └── example3.fut ├── manifest.fut ├── manylet.fut ├── map_tridag_par.fut ├── mapconcat.fut ├── mapiota.fut ├── mapmatmultfun.fut ├── mapreplicate.fut ├── mapslice.fut ├── matmultimp.fut ├── matmultrepa.fut ├── memory-block-merging │ ├── coalescing │ │ ├── chain │ │ │ ├── blk-chain2.fut │ │ │ ├── blk-chain3.fut │ │ │ ├── blk-chain4.fut │ │ │ ├── chain0.fut │ │ │ ├── chain1.fut │ │ │ ├── chain2.fut │ │ │ ├── chain3.fut │ │ │ ├── chain4.fut │ │ │ └── chain5.fut │ │ ├── concat │ │ │ ├── iotas.fut │ │ │ ├── neg0.fut │ │ │ ├── pos0.fut │ │ │ ├── pos1.fut │ │ │ ├── pos2.fut │ │ │ ├── pos3.fut │ │ │ └── same.fut │ │ ├── copy │ │ │ ├── neg0.fut │ │ │ ├── neg1.fut │ │ │ ├── pos0.fut │ │ │ ├── pos1.fut │ │ │ ├── pos2.fut │ │ │ ├── pos3.fut │ │ │ ├── pos4.fut │ │ │ └── pos5.fut │ │ ├── cosmin-tests │ │ │ ├── test-suc-alias.fut │ │ │ ├── test-suc-concat.fut │ │ │ ├── test-suc-if-1.fut │ │ │ ├── test-suc-loop-1.fut │ │ │ ├── test-suc-loop-2.fut │ │ │ └── test-suc-loop-3.fut │ │ ├── hoisting │ │ │ ├── alloc-hinder0.fut │ │ │ ├── concat.fut │ │ │ ├── copy-in-if.fut │ │ │ ├── copy.fut │ │ │ └── dependent.fut │ │ ├── if │ │ │ ├── both-inside.fut │ │ │ ├── both-outside.fut │ │ │ ├── if-neg-2.fut │ │ │ ├── if-neg-3-pos.fut │ │ │ ├── if-neg-3.fut │ │ │ ├── if-neg-4.fut │ │ │ ├── if-nonexist.fut │ │ │ └── one-inside-one-outside.fut │ │ ├── inplace-updates │ │ │ ├── fail.fut │ │ │ └── success.fut │ │ ├── iota-one-row.fut │ │ ├── issue-1789.fut │ │ ├── issue-1927.fut │ │ ├── issue-1930.fut │ │ ├── issue-2010.fut │ │ ├── loop │ │ │ ├── loop-ip.fut │ │ │ └── replicate-in-loop.fut │ │ ├── lud │ │ │ ├── lud.fut │ │ │ ├── lud_internal1-16.fut │ │ │ ├── lud_internal1.fut │ │ │ ├── lud_internal2.fut │ │ │ ├── lud_internal3.fut │ │ │ ├── lud_internal4.fut │ │ │ ├── lud_internal5.fut │ │ │ └── lud_internal6.fut │ │ ├── map │ │ │ ├── map.fut │ │ │ ├── map0.fut │ │ │ ├── map1.fut │ │ │ ├── map10.fut │ │ │ ├── map11.fut │ │ │ ├── map12.fut │ │ │ ├── map13.fut │ │ │ ├── map14.fut │ │ │ ├── map15.fut │ │ │ ├── map3.fut │ │ │ ├── map4.fut │ │ │ ├── map5.fut │ │ │ ├── map6.fut │ │ │ ├── map7.fut │ │ │ ├── map8.fut │ │ │ └── map9.fut │ │ ├── misc │ │ │ ├── choice0.fut │ │ │ └── two-dim-ker.fut │ │ ├── safety-condition-1 │ │ │ └── neg0.fut │ │ ├── safety-condition-2 │ │ │ ├── neg0.fut │ │ │ └── pos0.fut │ │ ├── safety-condition-3 │ │ │ ├── neg0.fut │ │ │ └── pos0.fut │ │ ├── safety-condition-4 │ │ │ └── neg0.fut │ │ ├── safety-condition-5 │ │ │ └── neg0.fut │ │ ├── test-impossible-asserts │ │ │ ├── iota-inlined-perfbug.fut │ │ │ ├── test1.fut │ │ │ ├── test2.fut │ │ │ ├── test3.fut │ │ │ └── test4.fut │ │ └── weird.fut │ ├── misc │ │ ├── brown-bridge-simple.fut │ │ └── ixfun-loop.fut │ └── reuse │ │ └── map-reduce-map.fut ├── migration │ ├── array0.fut │ ├── array1.fut │ ├── array2.fut │ ├── array3.fut │ ├── array4.fut │ ├── assert0.fut │ ├── assert1.fut │ ├── assert2.fut │ ├── assert3.fut │ ├── assert4.fut │ ├── blocking0_hostonly.fut │ ├── blocking1_array.fut │ ├── blocking2_concat.fut │ ├── blocking3_copy.fut │ ├── blocking4_iota.fut │ ├── blocking5_replicate.fut │ ├── blocking6_update.fut │ ├── blocking7_exception.fut │ ├── cse0.fut │ ├── cse1.fut │ ├── cse2.fut │ ├── flatindex.fut │ ├── flatupdate.fut │ ├── fun0_hostonly.fut │ ├── fun1_2-1.fut │ ├── fun2_2-1_unused.fut │ ├── fun3_2-2-1.fut │ ├── fun4_2-2.fut │ ├── fun5_2-3.fut │ ├── fun6_3-2.fut │ ├── fun7_3-2.fut │ ├── fun8_2-1_hostonly.fut │ ├── hist0.fut │ ├── hist1.fut │ ├── hoisted0.fut │ ├── hoisted1.fut │ ├── if0.fut │ ├── if1.fut │ ├── if10.fut │ ├── if2.fut │ ├── if3.fut │ ├── if4.fut │ ├── if5.fut │ ├── if6.fut │ ├── if7.fut │ ├── if8.fut │ ├── if9.fut │ ├── index0.fut │ ├── index1.fut │ ├── index2.fut │ ├── intrinsics.fut │ ├── iota.fut │ ├── kernels_hostonly.fut │ ├── loop0_inside.fut │ ├── loop10_blocked.fut │ ├── loop11_into.fut │ ├── loop12_into.fut │ ├── loop13_into.fut │ ├── loop14_into.fut │ ├── loop15_into.fut │ ├── loop16_into.fut │ ├── loop17_through.fut │ ├── loop18_through.fut │ ├── loop19_through.fut │ ├── loop1_tonext.fut │ ├── loop20_through.fut │ ├── loop2_out.fut │ ├── loop3_forin.fut │ ├── loop4_wholefor.fut │ ├── loop5_wholefor.fut │ ├── loop6_wholewhile.fut │ ├── loop7_wholewhile.fut │ ├── loop8_wholewhile.fut │ ├── loop9_wholewhile.fut │ ├── map-reduce.fut │ ├── merge0.fut │ ├── merge1.fut │ ├── merge2.fut │ ├── merge3.fut │ ├── merge4.fut │ ├── merge5.fut │ ├── merge6.fut │ ├── merge7.fut │ ├── reduce0.fut │ ├── reduce1.fut │ ├── reduction0_dup.fut │ ├── reduction10_mixed.fut │ ├── reduction1_2-1.fut │ ├── reduction2_3-1.fut │ ├── reduction3_2-1-2.fut │ ├── reduction4_2-2-2.fut │ ├── reduction5_2-3-2.fut │ ├── reduction6_2-3-1.fut │ ├── reduction7_3-2-4-2.fut │ ├── reduction8_3-2-4-1.fut │ ├── reduction9_deep2-1.fut │ ├── replicate0.fut │ ├── replicate1.fut │ ├── replicate2.fut │ ├── replicate3.fut │ ├── reshape.fut │ ├── reuse0_index.fut │ ├── reuse1_update.fut │ ├── reuse2_flatindex.fut │ ├── reuse3_flatupdate.fut │ ├── reuse4_scratch.fut │ ├── reuse5_reshape.fut │ ├── reuse6_rearrange.fut │ ├── scalar_ops.fut │ ├── scan0.fut │ ├── scan1.fut │ ├── sizevar0_reshape.fut │ ├── sizevar1_index.fut │ ├── sunk0.fut │ ├── sunk1.fut │ ├── top-level0.fut │ ├── top-level1.fut │ ├── update0.fut │ ├── update1.fut │ ├── withacc0.fut │ └── withacc1.fut ├── modules │ ├── Vec3.fut │ ├── anonymous-signature.fut │ ├── ascription-error0.fut │ ├── ascription-error1.fut │ ├── ascription-error2.fut │ ├── ascription-error3.fut │ ├── ascription-error4.fut │ ├── ascription-error5.fut │ ├── ascription-error6.fut │ ├── ascription-error7.fut │ ├── ascription-sizelifted0.fut │ ├── ascription-sizelifted1.fut │ ├── ascription-sizelifted2.fut │ ├── ascription-sizelifted3.fut │ ├── ascription0.fut │ ├── ascription1.fut │ ├── ascription10.fut │ ├── ascription11.fut │ ├── ascription12.fut │ ├── ascription13.fut │ ├── ascription14.fut │ ├── ascription15.fut │ ├── ascription2.fut │ ├── ascription3.fut │ ├── ascription4.fut │ ├── ascription5.fut │ ├── ascription6.fut │ ├── ascription7.fut │ ├── ascription8.fut │ ├── ascription9.fut │ ├── calling_nested_module.fut │ ├── duplicate_def.fut │ ├── duplicate_def0.fut │ ├── duplicate_def1.fut │ ├── duplicate_error0.fut │ ├── duplicate_error1.fut │ ├── entry.fut │ ├── fun_call_test.fut │ ├── functor-error0.fut │ ├── functor-error1.fut │ ├── functor0.fut │ ├── functor1.fut │ ├── functor10.fut │ ├── functor11.fut │ ├── functor12.fut │ ├── functor13.fut │ ├── functor14.fut │ ├── functor15.fut │ ├── functor16.fut │ ├── functor17.fut │ ├── functor18.fut │ ├── functor19.fut │ ├── functor2.fut │ ├── functor20.fut │ ├── functor21.fut │ ├── functor22.fut │ ├── functor23.fut │ ├── functor24.fut │ ├── functor25.fut │ ├── functor26.fut │ ├── functor27.fut │ ├── functor28.fut │ ├── functor29.fut │ ├── functor3.fut │ ├── functor30.fut │ ├── functor31.fut │ ├── functor4.fut │ ├── functor5.fut │ ├── functor6.fut │ ├── functor7.fut │ ├── functor8.fut │ ├── functor9.fut │ ├── hof0.fut │ ├── hof1.fut │ ├── hof2.fut │ ├── hof3.fut │ ├── hof4.fut │ ├── hof5.fut │ ├── hof6.fut │ ├── hof7.fut │ ├── hof8.fut │ ├── hof9.fut │ ├── import-qualified.fut │ ├── importee-qualified.fut │ ├── index_qual_array.fut │ ├── int_mod.fut │ ├── intrinsics-error.fut │ ├── lambda0.fut │ ├── lambda1.fut │ ├── lambda2.fut │ ├── liftedness0.fut │ ├── liftedness1.fut │ ├── liftedness2.fut │ ├── liftedness3.fut │ ├── local0.fut │ ├── local_open0.fut │ ├── local_open1.fut │ ├── local_open2.fut │ ├── local_open3.fut │ ├── local_open4.fut │ ├── map_with_structure0.fut │ ├── map_with_structure1.fut │ ├── module-spec-error0.fut │ ├── module-spec-error1.fut │ ├── module-spec-error2.fut │ ├── module-spec0.fut │ ├── module-spec1.fut │ ├── module-spec2.fut │ ├── module-spec3.fut │ ├── open0.fut │ ├── open1.fut │ ├── open4.fut │ ├── open5.fut │ ├── open6.fut │ ├── open7.fut │ ├── polymorphic-error0.fut │ ├── polymorphic0.fut │ ├── polymorphic1.fut │ ├── polymorphic2.fut │ ├── polymorphic3.fut │ ├── polymorphic4.fut │ ├── polymorphic5.fut │ ├── polymorphic6.fut │ ├── polymorphic7.fut │ ├── scope_behaviour.fut │ ├── shadowing0.fut │ ├── shadowing1.fut │ ├── shadowing2.fut │ ├── shadowing3.fut │ ├── shadowing4.fut │ ├── sig-error0.fut │ ├── sig-error1.fut │ ├── sig1.fut │ ├── sig3.fut │ ├── simple_nested_test.fut │ ├── simple_number_module.fut │ ├── sizeparams-error0.fut │ ├── sizeparams-error1.fut │ ├── sizeparams-error2.fut │ ├── sizeparams-error3.fut │ ├── sizeparams0.fut │ ├── sizeparams1.fut │ ├── sizeparams2.fut │ ├── sizeparams3.fut │ ├── sizeparams4.fut │ ├── sizeparams5.fut │ ├── sizeparams6.fut │ ├── sizeparams7.fut │ ├── sizeparams8.fut │ ├── sizes0.fut │ ├── sizes1.fut │ ├── sizes10.fut │ ├── sizes2.fut │ ├── sizes3.fut │ ├── sizes4.fut │ ├── sizes5.fut │ ├── sizes6.fut │ ├── sizes7.fut │ ├── sizes8.fut │ ├── sizes9.fut │ ├── struct-var.fut │ ├── triangles.fut │ ├── tst1.fut │ ├── tst2.fut │ ├── tst3.fut │ ├── tst4.fut │ ├── typeparams-error0.fut │ ├── typeparams-error1.fut │ ├── typeparams-error2.fut │ ├── typeparams0.fut │ ├── typeparams1.fut │ ├── undefined_structure_err0.fut │ ├── warn_type_shadow.fut │ ├── with-error0.fut │ ├── with-error1.fut │ ├── with-error2.fut │ ├── with-error3.fut │ ├── with-error4.fut │ ├── with0.fut │ ├── with1.fut │ ├── with2.fut │ ├── with3.fut │ ├── with4.fut │ └── with5.fut ├── mss.fut ├── mul0.fut ├── multinv16.fut ├── negate.fut ├── nestedmain.fut ├── noinline │ ├── noinline0.fut │ ├── noinline1.fut │ ├── noinline2.fut │ ├── noinline3.fut │ ├── noinline4.fut │ ├── noinline5.fut │ └── noinline6.fut ├── normalizeTest1.fut ├── opaque.fut ├── operator │ ├── section0.fut │ ├── section1.fut │ ├── section2.fut │ ├── section3.fut │ ├── section4.fut │ ├── section5.fut │ ├── section6.fut │ ├── size-section0.fut │ ├── size-section1.fut │ ├── size-section2.fut │ ├── size-section3.fut │ ├── size-section4.fut │ ├── userdef-error0.fut │ ├── userdef-error1.fut │ ├── userdef0.fut │ ├── userdef1.fut │ ├── userdef2.fut │ ├── userdef3.fut │ ├── userdef4.fut │ ├── userdef5.fut │ └── userdef6.fut ├── operators.fut ├── overflowing │ ├── edgecases.fut │ ├── f32high.fut │ ├── f32low.fut │ ├── f64low.fut │ ├── i16low.fut │ ├── i32high.fut │ ├── i8high.fut │ ├── i8low.fut │ ├── u16high.fut │ ├── u32low.fut │ ├── u8high.fut │ └── u8low.fut ├── parbits.fut ├── paths │ ├── has_abs.fut │ ├── subdir │ │ └── has_abs.fut │ └── use_abs.fut ├── perceptron.fut ├── phantomsizes.fut ├── pow.fut ├── powneg.fut ├── prefix_error.fut ├── prefix_prec.fut ├── primitive │ ├── README.md │ ├── acos32.fut │ ├── acos64.fut │ ├── acosh16.fut │ ├── acosh32.fut │ ├── acosh64.fut │ ├── acospi.fut │ ├── asin32.fut │ ├── asin64.fut │ ├── asinh16.fut │ ├── asinh32.fut │ ├── asinh64.fut │ ├── asinpi.fut │ ├── atan2_32.fut │ ├── atan2_64.fut │ ├── atan2pi.fut │ ├── atan32.fut │ ├── atan64.fut │ ├── atanh16.fut │ ├── atanh32.fut │ ├── atanh64.fut │ ├── atanpi.fut │ ├── bool_cmpop.fut │ ├── bool_convop.fut │ ├── cbrt.fut │ ├── ceil32.fut │ ├── ceil64.fut │ ├── clz.fut │ ├── copysign.fut │ ├── cos32.fut │ ├── cos64.fut │ ├── cosh16.fut │ ├── cosh32.fut │ ├── cosh64.fut │ ├── cospi.fut │ ├── ctz.fut │ ├── erf.fut │ ├── erfc.fut │ ├── f16.fut │ ├── f16_binop.fut │ ├── f16_minmax.fut │ ├── f32.fut │ ├── f32_binop.fut │ ├── f32_minmax.fut │ ├── f64.fut │ ├── f64_binop.fut │ ├── f64_minmax.fut │ ├── fabs.fut │ ├── float_convop.fut │ ├── floor32.fut │ ├── floor64.fut │ ├── fma_mad16.fut │ ├── fma_mad32.fut │ ├── fma_mad64.fut │ ├── fsignum.fut │ ├── gamma.fut │ ├── hypot.fut │ ├── i16_binop.fut │ ├── i16_bitop.fut │ ├── i16_cmpop.fut │ ├── i16_convop.fut │ ├── i16_division.fut │ ├── i16_minmax.fut │ ├── i16_unop.fut │ ├── i32_binop.fut │ ├── i32_bitop.fut │ ├── i32_cmpop.fut │ ├── i32_convop.fut │ ├── i32_division.fut │ ├── i32_minmax.fut │ ├── i32_unop.fut │ ├── i64_binop.fut │ ├── i64_bitop.fut │ ├── i64_cmpop.fut │ ├── i64_convop.fut │ ├── i64_division.fut │ ├── i64_minmax.fut │ ├── i64_unop.fut │ ├── i8_binop.fut │ ├── i8_bitop.fut │ ├── i8_cmpop.fut │ ├── i8_convop.fut │ ├── i8_division.fut │ ├── i8_minmax.fut │ ├── i8_unop.fut │ ├── ldexp.fut │ ├── lerp.fut │ ├── lgamma.fut │ ├── log32.fut │ ├── log64.fut │ ├── mad_hi.fut │ ├── mul_hi.fut │ ├── naninf32.fut │ ├── naninf64.fut │ ├── nextafter.fut │ ├── popc.fut │ ├── round32.fut │ ├── round64.fut │ ├── rsqrt.fut │ ├── signed_get_set_bit.fut │ ├── sin32.fut │ ├── sin64.fut │ ├── sinh16.fut │ ├── sinh32.fut │ ├── sinh64.fut │ ├── sinpi.fut │ ├── tan32.fut │ ├── tan64.fut │ ├── tanh16.fut │ ├── tanh32.fut │ ├── tanh64.fut │ ├── tanpi.fut │ ├── u16_binop.fut │ ├── u16_cmpop.fut │ ├── u16_convop.fut │ ├── u16_division.fut │ ├── u16_minmax.fut │ ├── u16_unop.fut │ ├── u32_binop.fut │ ├── u32_cmpop.fut │ ├── u32_convop.fut │ ├── u32_division.fut │ ├── u32_minmax.fut │ ├── u32_unop.fut │ ├── u64_binop.fut │ ├── u64_cmpop.fut │ ├── u64_convop.fut │ ├── u64_division.fut │ ├── u64_minmax.fut │ ├── u64_unop.fut │ ├── u8_binop.fut │ ├── u8_cmpop.fut │ ├── u8_convop.fut │ ├── u8_division.fut │ ├── u8_minmax.fut │ ├── u8_unop.fut │ └── unsigned_get_set_bit.fut ├── proj-error0.fut ├── proj-error1.fut ├── proj0.fut ├── proj1.fut ├── proj2.fut ├── proj3.fut ├── proj4.fut ├── psums.fut ├── quickmedian.fut ├── quickselect.fut ├── rand0.fut ├── random_test.fut ├── random_test_bool.fut ├── random_test_float.fut ├── range0.fut ├── range1.fut ├── rearrange0.fut ├── rearrange1.fut ├── rearrange2.fut ├── record-update0.fut ├── record-update1.fut ├── record-update2.fut ├── record-update3.fut ├── record-update4.fut ├── record-update5.fut ├── record-update6.fut ├── records-error0.fut ├── records-error2.fut ├── records-error3.fut ├── records-error4.fut ├── records-error5.fut ├── records-error6.fut ├── records-error7.fut ├── records-error8.fut ├── records-error9.fut ├── records0.fut ├── records1.fut ├── records10.fut ├── records11.fut ├── records2.fut ├── records3.fut ├── records4.fut ├── records5.fut ├── records6.fut ├── records7.fut ├── records8.fut ├── records9.fut ├── redomapNew.fut ├── redundant-merge-variable.fut ├── reg-tiling │ ├── batch-mm-lud.fut │ ├── batch-mm-lud.fut.tuning │ ├── mmm-tr.fut │ ├── mmm.fut │ ├── reg3d-test1.fut │ ├── reg3d-test1.fut.tuning │ ├── reg3d-test2.fut │ ├── reg3d-test2.fut.tuning │ ├── reg3d-test3.fut │ ├── reg3d-test3.fut.tuning │ ├── sgemm.fut │ └── sgemm.fut.tuning ├── renameTest.fut ├── replicate0.fut ├── replicate1.fut ├── replicate3.fut ├── reshape1.fut ├── reshape3.fut ├── reshape4.fut ├── returntype-error1.fut ├── returntype-error2.fut ├── returntype-error3.fut ├── returntype-error4.fut ├── revdims.fut ├── reverse0.fut ├── reverse1.fut ├── rosettacode │ ├── 100doors.fut │ ├── README.md │ ├── agm.fut │ ├── almostprime.fut │ ├── amicablepairs.fut │ ├── arithmetic_means.fut │ ├── binarydigits.fut │ ├── binarysearch.fut │ ├── complex.fut │ ├── count_in_octal.fut │ ├── eulermethod.fut │ ├── even_or_odd.fut │ ├── fact_iterative.fut │ ├── fibonacci_iterative.fut │ ├── filter.fut │ ├── for.fut │ ├── greatest_element_of_list.fut │ ├── hailstone.fut │ ├── integer_sequence.fut │ ├── life.fut │ ├── mandelbrot.fut │ ├── matrixmultiplication.fut │ ├── md5.fut │ ├── monte_carlo_methods.fut │ ├── pythagorean_means.fut │ ├── reverse_a_string.fut │ └── rms.fut ├── safety │ ├── div0.fut │ ├── map0.fut │ ├── powneg.fut │ ├── reduce0.fut │ ├── reduce1.fut │ ├── reduce_by_index0.fut │ ├── reduce_by_index1.fut │ ├── scan0.fut │ ├── scan1.fut │ └── scatter0.fut ├── saxpy.fut ├── scatter │ ├── data │ │ ├── tiny.in │ │ └── tiny.out │ ├── elimination │ │ ├── write-iota0.fut │ │ ├── write-iota1.fut │ │ ├── write-iota2.fut │ │ └── write-replicate0.fut │ ├── fusion │ │ ├── concat-scatter-fusion0.fut │ │ ├── concat-scatter-fusion1.fut │ │ ├── concat-scatter-fusion2.fut │ │ ├── map-write-fusion-not-possible0.fut │ │ ├── map-write-fusion-not-possible1.fut │ │ ├── map-write-fusion0.fut │ │ ├── map-write-fusion1.fut │ │ ├── scatter-scatter-not-possible.fut │ │ ├── write-fusion-mix0.fut │ │ ├── write-fusion-mix1.fut │ │ ├── write-write-fusion-not-possible0.fut │ │ ├── write-write-fusion-not-possible1.fut │ │ ├── write-write-fusion0.fut │ │ └── write-write-fusion1.fut │ ├── mapscatter.fut │ ├── nw.fut │ ├── scatter2d-2.fut │ ├── scatter2d.fut │ ├── scatter3d.fut │ ├── singleton.fut │ ├── write-error0.fut │ ├── write0.fut │ ├── write1.fut │ ├── write2.fut │ ├── write3.fut │ ├── write4.fut │ └── write5.fut ├── script │ ├── data │ │ └── input.in │ ├── opaques.fut │ ├── script0.fut │ ├── script1.fut │ ├── script2.fut │ ├── script3.fut │ ├── script3.futharkscript │ ├── script4.fut │ ├── script5.fut │ └── script6.fut ├── segredomap │ ├── add-then-reduce.fut │ ├── ex1-comm.fut │ ├── ex1-nocomm.fut │ ├── ex2.fut │ ├── ex3.fut │ ├── ex4.fut │ ├── ex6.fut │ ├── invariant-in-reduce.fut │ ├── map-add-then-reduce.fut │ ├── map-segsum-comm.fut │ ├── real-nocomm.fut │ ├── reduction-on-list.fut │ ├── segsum-comm.fut │ └── segsum-nocomm.fut ├── shapes │ ├── apply2.fut │ ├── argdims0.fut │ ├── argdims1.fut │ ├── ascript-existential.fut │ ├── assert0.fut │ ├── attr0.fut │ ├── cached.fut │ ├── coerce0.fut │ ├── coerce1.fut │ ├── compose.fut │ ├── concatmap.fut │ ├── curry-shapes.fut │ ├── duplicate-shapes-error.fut │ ├── emptydim0.fut │ ├── emptydim1.fut │ ├── emptydim2.fut │ ├── emptydim3.fut │ ├── entry-constants-sum.fut │ ├── entry-constants.fut │ ├── entry-lifted.fut │ ├── error0.fut │ ├── error1.fut │ ├── error10.fut │ ├── error12.fut │ ├── error13.fut │ ├── error14.fut │ ├── error2.fut │ ├── error3.fut │ ├── error4.fut │ ├── error5.fut │ ├── error6.fut │ ├── error7.fut │ ├── error8.fut │ ├── error9.fut │ ├── eta-expand0.fut │ ├── eta-expand1.fut │ ├── existential-apply-error.fut │ ├── existential-apply.fut │ ├── existential-argument.fut │ ├── existential-hof.fut │ ├── existential-ret.fut │ ├── explicit-shapes-error1.fut │ ├── explicit-shapes0.fut │ ├── extlet0.fut │ ├── extlet1.fut │ ├── field-in-size.fut │ ├── flatmap.fut │ ├── funshape0.fut │ ├── funshape1.fut │ ├── funshape2.fut │ ├── funshape3.fut │ ├── funshape4.fut │ ├── funshape5.fut │ ├── funshape6.fut │ ├── funshape7.fut │ ├── hof0.fut │ ├── hof1.fut │ ├── if0.fut │ ├── if1.fut │ ├── if2.fut │ ├── if3.fut │ ├── if4.fut │ ├── implicit-shape-use.fut │ ├── implicit-shape-use2.fut │ ├── inference6.fut │ ├── inference7.fut │ ├── inference8.fut │ ├── inference9.fut │ ├── irregular0.fut │ ├── known-shape.fut │ ├── lambda-return.fut │ ├── lambda-return2.fut │ ├── letshape0.fut │ ├── letshape1.fut │ ├── letshape10.fut │ ├── letshape11.fut │ ├── letshape12.fut │ ├── letshape2.fut │ ├── letshape3.fut │ ├── letshape4.fut │ ├── letshape5.fut │ ├── letshape6.fut │ ├── letshape7.fut │ ├── letshape8.fut │ ├── letshape9.fut │ ├── local0.fut │ ├── loop0.fut │ ├── loop1.fut │ ├── loop10.fut │ ├── loop11.fut │ ├── loop12.fut │ ├── loop13.fut │ ├── loop14.fut │ ├── loop15.fut │ ├── loop2.fut │ ├── loop3.fut │ ├── loop4.fut │ ├── loop5.fut │ ├── loop6.fut │ ├── loop7.fut │ ├── loop8.fut │ ├── loop9.fut │ ├── match0.fut │ ├── match1.fut │ ├── match2.fut │ ├── modules0.fut │ ├── modules1.fut │ ├── modules2.fut │ ├── negative-position-shape0.fut │ ├── negative-position-shape1.fut │ ├── negative-position-shape2.fut │ ├── negative-position-shape3.fut │ ├── negative-position-shape4.fut │ ├── negative-position-shape5.fut │ ├── nonint-shape-error.fut │ ├── opaque0.fut │ ├── paramsize0.fut │ ├── paramsize1.fut │ ├── partial-apply.fut │ ├── pointfree0.fut │ ├── pointfree1.fut │ ├── polymorphic1.fut │ ├── polymorphic2.fut │ ├── polymorphic3.fut │ ├── polymorphic4.fut │ ├── project0.fut │ ├── range0.fut │ ├── range1.fut │ ├── range2.fut │ ├── return0.fut │ ├── shape-annot-is-param.fut │ ├── shape-inside-tuple.fut │ ├── shape_duplicate.fut │ ├── shape_in_ascription.fut │ ├── shape_in_tuple.fut │ ├── size-inference0.fut │ ├── size-inference1.fut │ ├── size-inference2.fut │ ├── size-inference3.fut │ ├── size-inference4.fut │ ├── size-inference5.fut │ ├── size-inference6.fut │ ├── size-inference7.fut │ ├── slice0.fut │ ├── slice1.fut │ ├── toplevel0.fut │ ├── toplevel1.fut │ ├── toplevel2.fut │ ├── unknown-param.fut │ └── use-shapes.fut ├── shortcircuit-and.fut ├── shortcircuit-or.fut ├── simplify_primexp.fut ├── sinking0.fut ├── sinking1.fut ├── sinking2.fut ├── sinking4.fut ├── sinking5.fut ├── sinking6.fut ├── size-expr-for-in.fut ├── size-from-division.fut ├── slice-lmads │ ├── bounds.fut │ ├── flat.fut │ ├── intrinsics.fut │ ├── lud.fut │ ├── nw-cosmin.fut │ ├── nw.fut │ ├── small.fut │ ├── small_2d.fut │ └── small_4d.fut ├── slice0.fut ├── slice1.fut ├── slice2.fut ├── slice3.fut ├── slice4.fut ├── slice5.fut ├── slice6.fut ├── soacs │ ├── filter-error0.fut │ ├── filter1.fut │ ├── filter2.fut │ ├── filter3.fut │ ├── filter4.fut │ ├── map1-error.fut │ ├── map1.fut │ ├── map10.fut │ ├── map14.fut │ ├── map15.fut │ ├── map16.fut │ ├── map18.fut │ ├── map19.fut │ ├── map2.fut │ ├── map20.fut │ ├── map3.fut │ ├── map4.fut │ ├── map5.fut │ ├── map6.fut │ ├── map7.fut │ ├── map9.fut │ ├── mapreduce.fut │ ├── mapscan.fut │ ├── partition1.fut │ ├── partition2.fut │ ├── redomap0.fut │ ├── redomap1.fut │ ├── reduce0.fut │ ├── reduce1.fut │ ├── reduce10.fut │ ├── reduce2.fut │ ├── reduce3.fut │ ├── reduce4.fut │ ├── reduce5.fut │ ├── reduce6.fut │ ├── reduce7.fut │ ├── reduce8.fut │ ├── reduce9.fut │ ├── scan-with-map.fut │ ├── scan0.fut │ ├── scan1.fut │ ├── scan2.fut │ ├── scan3.fut │ ├── scan4.fut │ ├── scan5.fut │ ├── scan6.fut │ ├── scan7.fut │ ├── scan8.fut │ └── segreduce-iota.fut ├── stacktrace.fut ├── stencil-1.fut ├── stencil-2.fut ├── sumtypes │ ├── coerce0.fut │ ├── coerce1.fut │ ├── coerce2.fut │ ├── existential-match.fut │ ├── sumtype0.fut │ ├── sumtype1.fut │ ├── sumtype10.fut │ ├── sumtype11.fut │ ├── sumtype12.fut │ ├── sumtype13.fut │ ├── sumtype14.fut │ ├── sumtype15.fut │ ├── sumtype16.fut │ ├── sumtype17.fut │ ├── sumtype18.fut │ ├── sumtype19.fut │ ├── sumtype2.fut │ ├── sumtype20.fut │ ├── sumtype21.fut │ ├── sumtype22.fut │ ├── sumtype23.fut │ ├── sumtype24.fut │ ├── sumtype25.fut │ ├── sumtype26.fut │ ├── sumtype27.fut │ ├── sumtype28.fut │ ├── sumtype29.fut │ ├── sumtype3.fut │ ├── sumtype30.fut │ ├── sumtype31.fut │ ├── sumtype32.fut │ ├── sumtype33.fut │ ├── sumtype34.fut │ ├── sumtype35.fut │ ├── sumtype36.fut │ ├── sumtype37.fut │ ├── sumtype38.fut │ ├── sumtype39.fut │ ├── sumtype4.fut │ ├── sumtype40.fut │ ├── sumtype41.fut │ ├── sumtype42.fut │ ├── sumtype43.fut │ ├── sumtype44.fut │ ├── sumtype45.fut │ ├── sumtype46.fut │ ├── sumtype47.fut │ ├── sumtype48.fut │ ├── sumtype49.fut │ ├── sumtype5.fut │ ├── sumtype50.fut │ ├── sumtype51.fut │ ├── sumtype52.fut │ ├── sumtype6.fut │ ├── sumtype7.fut │ ├── sumtype8.fut │ └── sumtype9.fut ├── three_way_partition.fut ├── tiling │ ├── issue1933.fut │ ├── issue1940.fut │ ├── notile_loopvariant.fut │ ├── seqloop_1d.fut │ ├── seqloop_1d_postlude.fut │ ├── seqloop_2d.fut │ ├── tiling2.fut │ ├── tiling_1d.fut │ ├── tiling_1d_complex.fut │ ├── tiling_1d_partial.fut │ ├── tiling_2d.fut │ ├── tiling_2d_indirect.fut │ ├── tiling_2d_inner.fut │ ├── tiling_2d_partial.fut │ ├── tricky_prelude0.fut │ └── tricky_prelude1.fut ├── tokens.fut ├── trailing-commas.fut ├── transpose1.fut ├── transpose2.fut ├── tridag.fut ├── tupleTest.fut ├── tupleindex.fut ├── types │ ├── README.md │ ├── alias-error0.fut │ ├── alias-error2.fut │ ├── alias-error3.fut │ ├── alias-error4.fut │ ├── alias-error5.fut │ ├── alias0.fut │ ├── alias1.fut │ ├── alias2.fut │ ├── alias3.fut │ ├── alias4.fut │ ├── alias5.fut │ ├── badsquare-lam.fut │ ├── badsquare.fut │ ├── error0.fut │ ├── ext0.fut │ ├── ext1.fut │ ├── ext2.fut │ ├── ext3.fut │ ├── ext4.fut │ ├── ext5.fut │ ├── ext6.fut │ ├── ext7.fut │ ├── ext8.fut │ ├── ext9.fut │ ├── function-error0.fut │ ├── function-error2.fut │ ├── function-error3.fut │ ├── function0.fut │ ├── function1.fut │ ├── function2.fut │ ├── function3.fut │ ├── function4.fut │ ├── function5.fut │ ├── function6.fut │ ├── function7.fut │ ├── inference-error1.fut │ ├── inference-error10.fut │ ├── inference-error12.fut │ ├── inference-error13.fut │ ├── inference-error14.fut │ ├── inference-error2.fut │ ├── inference-error3.fut │ ├── inference-error4.fut │ ├── inference-error5.fut │ ├── inference-error7.fut │ ├── inference-error8.fut │ ├── inference-error9.fut │ ├── inference0.fut │ ├── inference1.fut │ ├── inference10.fut │ ├── inference11.fut │ ├── inference12.fut │ ├── inference13.fut │ ├── inference14.fut │ ├── inference15.fut │ ├── inference16.fut │ ├── inference17.fut │ ├── inference18.fut │ ├── inference19.fut │ ├── inference2.fut │ ├── inference20.fut │ ├── inference21.fut │ ├── inference22.fut │ ├── inference23.fut │ ├── inference24.fut │ ├── inference25.fut │ ├── inference26.fut │ ├── inference27.fut │ ├── inference28.fut │ ├── inference29.fut │ ├── inference3.fut │ ├── inference30.fut │ ├── inference31.fut │ ├── inference32.fut │ ├── inference33.fut │ ├── inference34.fut │ ├── inference35.fut │ ├── inference36.fut │ ├── inference37.fut │ ├── inference4.fut │ ├── inference5.fut │ ├── inference6.fut │ ├── inference7.fut │ ├── inference8.fut │ ├── inference9.fut │ ├── level0.fut │ ├── level1.fut │ ├── level2.fut │ ├── level3.fut │ ├── level4.fut │ ├── level5.fut │ ├── level6.fut │ ├── lifted-abbrev.fut │ ├── metasizes.fut │ ├── overloaded0.fut │ ├── overloaded1.fut │ ├── size-lifted-abbrev.fut │ ├── size-lifted0.fut │ ├── size-lifted1.fut │ ├── size-lifted2.fut │ ├── sizeparams-error0.fut │ ├── sizeparams-error1.fut │ ├── sizeparams-error2.fut │ ├── sizeparams0.fut │ ├── sizeparams1.fut │ ├── sizeparams10.fut │ ├── sizeparams11.fut │ ├── sizeparams2.fut │ ├── sizeparams3.fut │ ├── sizeparams4.fut │ ├── sizeparams5.fut │ ├── sizeparams6.fut │ ├── sizeparams7.fut │ ├── sizeparams8.fut │ ├── sizeparams9.fut │ ├── square.fut │ ├── tricky.fut │ ├── typeparams-error0.fut │ ├── typeparams-error1.fut │ ├── typeparams-error2.fut │ ├── typeparams-error5.fut │ ├── typeparams0.fut │ ├── typeparams1.fut │ └── typeparams2.fut ├── unflatten0.fut ├── uniqueness │ ├── uniqueness-error0.fut │ ├── uniqueness-error1.fut │ ├── uniqueness-error10.fut │ ├── uniqueness-error11.fut │ ├── uniqueness-error12.fut │ ├── uniqueness-error13.fut │ ├── uniqueness-error14.fut │ ├── uniqueness-error15.fut │ ├── uniqueness-error16.fut │ ├── uniqueness-error17.fut │ ├── uniqueness-error18.fut │ ├── uniqueness-error19.fut │ ├── uniqueness-error2.fut │ ├── uniqueness-error20.fut │ ├── uniqueness-error21.fut │ ├── uniqueness-error22.fut │ ├── uniqueness-error23.fut │ ├── uniqueness-error24.fut │ ├── uniqueness-error25.fut │ ├── uniqueness-error26.fut │ ├── uniqueness-error27.fut │ ├── uniqueness-error28.fut │ ├── uniqueness-error29.fut │ ├── uniqueness-error3.fut │ ├── uniqueness-error30.fut │ ├── uniqueness-error31.fut │ ├── uniqueness-error33.fut │ ├── uniqueness-error34.fut │ ├── uniqueness-error35.fut │ ├── uniqueness-error36.fut │ ├── uniqueness-error37.fut │ ├── uniqueness-error38.fut │ ├── uniqueness-error39.fut │ ├── uniqueness-error4.fut │ ├── uniqueness-error40.fut │ ├── uniqueness-error41.fut │ ├── uniqueness-error42.fut │ ├── uniqueness-error43.fut │ ├── uniqueness-error44.fut │ ├── uniqueness-error45.fut │ ├── uniqueness-error46.fut │ ├── uniqueness-error47.fut │ ├── uniqueness-error48.fut │ ├── uniqueness-error49.fut │ ├── uniqueness-error5.fut │ ├── uniqueness-error50.fut │ ├── uniqueness-error51.fut │ ├── uniqueness-error52.fut │ ├── uniqueness-error53.fut │ ├── uniqueness-error54.fut │ ├── uniqueness-error55.fut │ ├── uniqueness-error56.fut │ ├── uniqueness-error57.fut │ ├── uniqueness-error58.fut │ ├── uniqueness-error59.fut │ ├── uniqueness-error6.fut │ ├── uniqueness-error60.fut │ ├── uniqueness-error61.fut │ ├── uniqueness-error62.fut │ ├── uniqueness-error63.fut │ ├── uniqueness-error64.fut │ ├── uniqueness-error65.fut │ ├── uniqueness-error7.fut │ ├── uniqueness-error8.fut │ ├── uniqueness-error9.fut │ ├── uniqueness0.fut │ ├── uniqueness1.fut │ ├── uniqueness10.fut │ ├── uniqueness11.fut │ ├── uniqueness12.fut │ ├── uniqueness13.fut │ ├── uniqueness14.fut │ ├── uniqueness17.fut │ ├── uniqueness18.fut │ ├── uniqueness19.fut │ ├── uniqueness2.fut │ ├── uniqueness20.fut │ ├── uniqueness21.fut │ ├── uniqueness22.fut │ ├── uniqueness23.fut │ ├── uniqueness24.fut │ ├── uniqueness25.fut │ ├── uniqueness26.fut │ ├── uniqueness27.fut │ ├── uniqueness3.fut │ ├── uniqueness4.fut │ ├── uniqueness51.fut │ ├── uniqueness52.fut │ ├── uniqueness53.fut │ ├── uniqueness54.fut │ ├── uniqueness55.fut │ ├── uniqueness56.fut │ ├── uniqueness57.fut │ ├── uniqueness58.fut │ ├── uniqueness59.fut │ ├── uniqueness6.fut │ ├── uniqueness60.fut │ ├── uniqueness7.fut │ ├── uniqueness8.fut │ └── uniqueness9.fut ├── unscoping.fut ├── unused-reduce.fut ├── vasicek │ └── iobound-mc2.fut └── zip0.fut ├── tests_adhoc ├── bad_input │ ├── .gitignore │ ├── bad_input.fut │ └── test.sh ├── eval │ ├── test.fut │ └── test.sh ├── hash │ ├── test.fut │ └── test.sh ├── literate_trace │ ├── test.sh │ └── trace.fut ├── nobench │ ├── .gitignore │ ├── nobench.fut │ └── test.sh ├── notest │ ├── .gitignore │ ├── notest.fut │ └── test.sh ├── profile │ ├── .gitignore │ ├── prog.fut │ └── test.sh ├── script │ ├── .gitignore │ ├── double.fut │ └── test.sh └── test.sh ├── tests_bench ├── .gitignore ├── consume.fut └── test.sh ├── tests_fmt ├── comment.fut ├── expected │ ├── comment.fut │ ├── extra_equals.fut │ ├── header_comment.fut │ ├── if.fut │ ├── lambda.fut │ ├── lastarg.fut │ ├── let_linebreak.fut │ ├── local.fut │ ├── loop.fut │ ├── modules.fut │ ├── nested_letIn.fut │ ├── nested_letWith.fut │ ├── numbers.fut │ ├── pat.fut │ ├── records.fut │ ├── singlelines.fut │ ├── sumtype.fut │ ├── trailingComments1.fut │ ├── trailingComments2.fut │ └── with.fut ├── header_comment.fut ├── if.fut ├── lambda.fut ├── lastarg.fut ├── let_linebreak.fut ├── local.fut ├── loop.fut ├── modules.fut ├── nested_letIn.fut ├── nested_letWith.fut ├── numbers.fut ├── pat.fut ├── records.fut ├── singlelines.fut ├── sumtype.fut ├── test.sh ├── trailingComments1.fut ├── trailingComments2.fut └── with.fut ├── tests_lib ├── README.md ├── c │ ├── .gitignore │ ├── Makefile │ ├── README.md │ ├── a.fut │ ├── b.fut │ ├── c.fut │ ├── const_error.fut │ ├── const_error_par.fut │ ├── d.fut │ ├── e.fut │ ├── f.fut │ ├── g.fut │ ├── index.fut │ ├── opaque_array.fut │ ├── phantomsize.fut │ ├── project.fut │ ├── raw.fut │ ├── record_array.fut │ ├── restore.fut │ ├── sum.fut │ ├── test_a.c │ ├── test_b.c │ ├── test_c.c │ ├── test_const_error.c │ ├── test_const_error_par.c │ ├── test_d.c │ ├── test_e.c │ ├── test_f.c │ ├── test_g.c │ ├── test_index.c │ ├── test_opaque_array.c │ ├── test_phantomsize.c │ ├── test_project.c │ ├── test_raw.c │ ├── test_record_array.c │ ├── test_restore.c │ ├── test_sum.c │ └── validatemanifest.py ├── javascript │ ├── Makefile │ ├── a.fut │ ├── array.fut │ ├── package.json │ ├── test_a.js │ └── test_array.js └── python │ ├── .gitignore │ ├── Makefile │ ├── a.fut │ ├── g.fut │ ├── test_a │ └── test_g ├── tests_literate ├── .gitignore ├── audio.fut ├── basic.fut ├── coerce.fut ├── data │ ├── array.in │ └── array_and_value.in ├── expected │ ├── audio.md │ ├── basic.md │ ├── coerce.md │ ├── img.md │ ├── img_noentry.md │ ├── loaddata.md │ ├── loadimg.md │ ├── nonl.md │ ├── opaque_tuple.md │ ├── tuple.md │ └── video.md ├── img.fut ├── img_noentry.fut ├── loaddata.fut ├── loadimg.fut ├── mono.wav ├── nonl.fut ├── opaque_tuple.fut ├── stereo.wav ├── test.sh ├── tuple.fut └── video.fut ├── tests_pkg ├── .gitignore ├── README.md ├── futhark.pkg.0 ├── futhark.pkg.1 ├── futhark.pkg.10 ├── futhark.pkg.11 ├── futhark.pkg.12 ├── futhark.pkg.13 ├── futhark.pkg.14 ├── futhark.pkg.15 ├── futhark.pkg.16 ├── futhark.pkg.17 ├── futhark.pkg.18 ├── futhark.pkg.2 ├── futhark.pkg.3 ├── futhark.pkg.4 ├── futhark.pkg.5 ├── futhark.pkg.6 ├── futhark.pkg.7 ├── futhark.pkg.8 ├── futhark.pkg.9 ├── lib.10 │ └── github.com │ │ └── athas │ │ ├── fut-bar │ │ └── bar.fut │ │ ├── fut-baz │ │ └── baz.fut │ │ ├── fut-foo │ │ └── foo.fut │ │ └── fut-foo@2 │ │ └── foo.fut ├── lib.11 │ └── github.com │ │ └── athas │ │ ├── fut-bar │ │ └── bar.fut │ │ ├── fut-baz │ │ └── baz.fut │ │ ├── fut-foo │ │ └── foo.fut │ │ └── fut-foo@2 │ │ └── foo.fut ├── lib.12 │ └── github.com │ │ └── athas │ │ ├── fut-bar │ │ └── bar.fut │ │ ├── fut-baz │ │ └── baz.fut │ │ ├── fut-foo │ │ └── foo.fut │ │ ├── fut-foo@2 │ │ └── foo.fut │ │ └── fut-quux │ │ └── quux.fut ├── lib.13 │ └── github.com │ │ └── athas │ │ ├── fut-bar │ │ └── bar.fut │ │ ├── fut-baz │ │ └── baz.fut │ │ ├── fut-foo │ │ └── foo.fut │ │ ├── fut-foo@2 │ │ └── foo.fut │ │ └── fut-quux │ │ └── quux.fut ├── lib.14 │ └── github.com │ │ └── athas │ │ ├── fut-bar │ │ └── bar.fut │ │ ├── fut-baz │ │ └── baz.fut │ │ ├── fut-foo │ │ └── foo.fut │ │ ├── fut-foo@2 │ │ └── foo.fut │ │ └── fut-quux │ │ └── quux.fut ├── lib.15 │ └── github.com │ │ └── athas │ │ ├── fut-bar │ │ └── bar.fut │ │ ├── fut-baz │ │ └── baz.fut │ │ ├── fut-foo │ │ └── foo.fut │ │ ├── fut-foo@2 │ │ └── foo.fut │ │ └── fut-quux │ │ └── quux.fut ├── lib.16 │ ├── github.com │ │ └── athas │ │ │ ├── fut-bar │ │ │ └── bar.fut │ │ │ ├── fut-baz │ │ │ └── baz.fut │ │ │ ├── fut-foo │ │ │ └── foo.fut │ │ │ ├── fut-foo@2 │ │ │ └── foo.fut │ │ │ └── fut-quux │ │ │ └── quux.fut │ └── gitlab.com │ │ └── athas │ │ └── fut-gitlab │ │ └── gitlab.fut ├── lib.17 │ └── github.com │ │ └── athas │ │ ├── fut-bar │ │ └── bar.fut │ │ ├── fut-baz │ │ └── baz.fut │ │ ├── fut-foo │ │ └── foo.fut │ │ ├── fut-foo@2 │ │ └── foo.fut │ │ └── fut-quux │ │ └── quux.fut ├── lib.18 │ ├── github.com │ │ └── athas │ │ │ ├── fut-bar │ │ │ └── bar.fut │ │ │ ├── fut-baz │ │ │ └── baz.fut │ │ │ ├── fut-foo │ │ │ └── foo.fut │ │ │ ├── fut-foo@2 │ │ │ └── foo.fut │ │ │ └── fut-quux │ │ │ └── quux.fut │ └── gitlab.com │ │ └── athas │ │ └── fut-gitlab │ │ └── gitlab.fut ├── lib.2 │ └── github.com │ │ └── athas │ │ └── fut-foo │ │ └── foo.fut ├── lib.3 │ └── github.com │ │ └── athas │ │ └── fut-foo │ │ └── foo.fut ├── lib.4 │ └── github.com │ │ └── athas │ │ ├── fut-baz │ │ └── baz.fut │ │ └── fut-foo │ │ └── foo.fut ├── lib.5 │ └── github.com │ │ └── athas │ │ ├── fut-baz │ │ └── baz.fut │ │ └── fut-foo │ │ └── foo.fut ├── lib.6 │ └── github.com │ │ └── athas │ │ ├── fut-bar │ │ └── bar.fut │ │ ├── fut-baz │ │ └── baz.fut │ │ └── fut-foo │ │ └── foo.fut ├── lib.7 │ └── github.com │ │ └── athas │ │ ├── fut-bar │ │ └── bar.fut │ │ ├── fut-baz │ │ └── baz.fut │ │ └── fut-foo │ │ └── foo.fut ├── lib.8 │ └── github.com │ │ └── athas │ │ ├── fut-bar │ │ └── bar.fut │ │ ├── fut-baz │ │ └── baz.fut │ │ └── fut-foo │ │ └── foo.fut ├── lib.9 │ └── github.com │ │ └── athas │ │ ├── fut-bar │ │ └── bar.fut │ │ ├── fut-baz │ │ └── baz.fut │ │ └── fut-foo │ │ └── foo.fut └── test.sh ├── tests_repl ├── .gitignore ├── issue1347.fut ├── issue1347.in ├── issue1347.out ├── local.fut ├── local.in ├── local.out └── test.sh ├── tools ├── .gitignore ├── README.md ├── auto-hlint.sh ├── bench-compilers.py ├── changelog.sh ├── commit-impact.py ├── compare-compiler-versions.sh ├── data2fut.py ├── data2png.py ├── futcolor ├── futhark-listings.tex ├── futhark.lang ├── generate-module-list.sh ├── git-hooks │ ├── README │ └── pre-commit ├── install-everywhere.sh ├── let2def.py ├── node-simd.sh ├── node-threaded.sh ├── oclgrindrunner.sh ├── plot-bench.py ├── png2data.py ├── release │ ├── README.md │ ├── binary-deb.sh │ ├── binary-tarball.sh │ ├── deb-skeleton │ │ └── DEBIAN │ │ │ └── control │ ├── hackage.sh │ └── skeleton │ │ ├── Makefile │ │ ├── README.md │ │ └── config.mk ├── remove-from-bench-json.py ├── run-formatter.sh ├── style-check-file.sh ├── style-check.sh ├── test-autotuner.sh ├── testfmt.sh └── testparser.sh └── weeder.toml /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "futhark-benchmarks"] 2 | path = futhark-benchmarks 3 | url = https://github.com/diku-dk/futhark-benchmarks.git 4 | -------------------------------------------------------------------------------- /CITATION.cff: -------------------------------------------------------------------------------- 1 | cff-version: 1.2.0 2 | message: "If you use this software, please cite it as below." 3 | authors: 4 | - given-names: "The Futhark Hackers" 5 | title: "Futhark" 6 | url: "https://github.com/diku-dk/futhark" 7 | -------------------------------------------------------------------------------- /Setup.hs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env runhaskell 2 | 3 | import Distribution.Simple 4 | 5 | main :: IO () 6 | main = defaultMainWithHooks myHooks 7 | where myHooks = simpleUserHooks 8 | -------------------------------------------------------------------------------- /assets/ohyes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diku-dk/futhark/e4c272556d6dd5c0832b3e522c3e408cfb748141/assets/ohyes.png -------------------------------------------------------------------------------- /cabal.project: -------------------------------------------------------------------------------- 1 | packages: futhark.cabal 2 | index-state: 2025-05-28T09:14:26Z 3 | 4 | package futhark 5 | ghc-options: -j -fwrite-ide-info -hiedir=.hie 6 | 7 | allow-newer: base, template-haskell, ghc-prim 8 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | # Sphinx build folder 2 | _build -------------------------------------------------------------------------------- /docs/default.nix: -------------------------------------------------------------------------------- 1 | with import {}; 2 | stdenv.mkDerivation { 3 | name = "futhark-docs"; 4 | buildInputs = [ python37Packages.sphinx ]; 5 | } 6 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | pyyaml>=4.2b1 2 | sphinx>=4.2.0 3 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.black] 2 | line-length = 79 3 | exclude = "benchmark-performance-plot.py" 4 | -------------------------------------------------------------------------------- /rts/c/errors.h: -------------------------------------------------------------------------------- 1 | #define FUTHARK_SUCCESS 0 2 | #define FUTHARK_PROGRAM_ERROR 2 3 | #define FUTHARK_OUT_OF_MEMORY 3 4 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [mypy] 2 | ignore_missing_imports = True 3 | exclude = benchmark-performance-plot.py|conf.py 4 | -------------------------------------------------------------------------------- /src/Futhark/Util/Loc.hs: -------------------------------------------------------------------------------- 1 | -- | A Safe Haskell-trusted re-export of the @srcloc@ package. 2 | module Futhark.Util.Loc (module Data.Loc) where 3 | 4 | import Data.Loc 5 | -------------------------------------------------------------------------------- /tests/ad/cert.fut: -------------------------------------------------------------------------------- 1 | -- Quick test that we don't crash in the presence of certificates used 2 | -- free in vjp. 3 | 4 | def main y = vjp (map (\x -> x / y)) 5 | -------------------------------------------------------------------------------- /tests/ad/clz.fut: -------------------------------------------------------------------------------- 1 | -- Tricky because clz has a different return type than input type. 2 | -- Not really differentiable, though. 3 | -- == 4 | 5 | entry vjp_u64 = vjp u64.clz 6 | entry jvp_u64 = jvp u64.clz 7 | -------------------------------------------------------------------------------- /tests/ad/fwd/map0.fut: -------------------------------------------------------------------------------- 1 | def f x = map (*(x*x)) [0,1,2] 2 | 3 | -- == 4 | -- entry: f_jvp 5 | -- input { 2 } output { [0, 4, 8] } 6 | -- input { 4 } output { [0, 8, 16] } 7 | entry f_jvp x = jvp f x 1 8 | -------------------------------------------------------------------------------- /tests/ad/fwd/red0.fut: -------------------------------------------------------------------------------- 1 | def f x = reduce (*) 1 [1,2,x,4] 2 | 3 | -- == 4 | -- entry: f_jvp 5 | -- input { 3 } output { 8 } 6 | -- input { 10 } output { 8 } 7 | entry f_jvp x = jvp f x 1 8 | -------------------------------------------------------------------------------- /tests/ad/fwd/scatter0.fut: -------------------------------------------------------------------------------- 1 | def f x = 2 | let vs = [x, x*x, x*x*x] 3 | in spread 5 1 [0,1,2] vs 4 | 5 | -- == 6 | -- entry: f_jvp 7 | -- input { 5 } output { [1, 10, 75, 0, 0] } 8 | entry f_jvp x = jvp f x 1 9 | -------------------------------------------------------------------------------- /tests/ad/imul.fut: -------------------------------------------------------------------------------- 1 | -- Check the absence of integer overflow. 2 | -- == 3 | -- input { 2000000000i32 2000000000i32 } output { -294967296i32 } 4 | 5 | def main x y : i32 = vjp (\x -> x * y) x 2 6 | -------------------------------------------------------------------------------- /tests/ad/iota0.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- entry: rev 3 | -- compiled input { 5i64 } 4 | -- output { 5i64 } 5 | 6 | def f (n: i64) = i64.sum (iota n) 7 | 8 | entry rev n = vjp f n 1 9 | -------------------------------------------------------------------------------- /tests/ad/map0.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- entry: rev 3 | -- input { [1,2,3] [3,2,1] } 4 | -- output { [6,4,2] } 5 | 6 | entry rev = vjp (map (*2i32)) 7 | -------------------------------------------------------------------------------- /tests/ad/negate.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- entry: fwd rev 3 | -- input { 1f32 } output { -1f32 } 4 | -- input { 3f32 } output { -1f32 } 5 | 6 | def f x : f32 = -x 7 | 8 | entry fwd x = jvp f x 1 9 | entry rev x = jvp f x 1 10 | -------------------------------------------------------------------------------- /tests/ad/not.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- entry: fwd rev 3 | -- input { true } output { true } 4 | 5 | def f x : bool = !x 6 | 7 | entry fwd x = jvp f x true 8 | entry rev x = jvp f x true 9 | -------------------------------------------------------------------------------- /tests/ad/rev_const.fut: -------------------------------------------------------------------------------- 1 | -- What happens if a result is constant? 2 | -- == 3 | -- input { 1f32 2f32 } output { 1f32 1f32 } 4 | 5 | def main (x: f32) (y: f32) = 6 | vjp (\(x',y') -> (x' + y', 0)) (x,y) (1, 0) 7 | -------------------------------------------------------------------------------- /tests/ad/rev_unused.fut: -------------------------------------------------------------------------------- 1 | -- What happens if not all the parameters are used? 2 | -- == 3 | -- input { 1f32 2f32 } output { 1f32 0f32 } 4 | 5 | def main (x: f32) (y: f32) = 6 | vjp (\(x',_) -> x' + 2) (x,y) 1 7 | -------------------------------------------------------------------------------- /tests/ascription1.fut: -------------------------------------------------------------------------------- 1 | -- Basic expression-level type ascription error. 2 | -- 3 | -- == 4 | -- error: f64.*i32 5 | 6 | def main(x: i32) = x : f64 7 | -------------------------------------------------------------------------------- /tests/ascription3.fut: -------------------------------------------------------------------------------- 1 | -- Array type ascription cannot change the rank of an array. 2 | -- 3 | -- == 4 | -- error: Expression does not have expected type 5 | 6 | def main [n][m] (x: [n][m]i32) = x : []i32 7 | -------------------------------------------------------------------------------- /tests/ascription4.fut: -------------------------------------------------------------------------------- 1 | -- Ascription inside a lambda applies to the lambda body. 2 | 3 | def main = \x -> x + 2 : i32 4 | -------------------------------------------------------------------------------- /tests/assert0.fut: -------------------------------------------------------------------------------- 1 | -- Basic assertion 2 | -- == 3 | -- input { 2 } output { 1 } 4 | -- input { 3 } error: x % 2 == 0 5 | 6 | def main (x: i32) = assert (x%2 == 0) (x/2) 7 | -------------------------------------------------------------------------------- /tests/assert1.fut: -------------------------------------------------------------------------------- 1 | -- Assertion of functional value. 2 | -- == 3 | -- input { 2 } output { 1 } 4 | -- input { 3 } error: x % 2 == 0 5 | 6 | def main (x: i32) = 7 | let f = assert (x%2 == 0) (x/) 8 | in f 2 9 | -------------------------------------------------------------------------------- /tests/assert2.fut: -------------------------------------------------------------------------------- 1 | -- Assertion condition must be a boolean. 2 | -- == 3 | -- error: bool 4 | 5 | def main (x: i32) = assert 0 (x/2) 6 | -------------------------------------------------------------------------------- /tests/assert3.fut: -------------------------------------------------------------------------------- 1 | -- unsafe can remove assertions. 2 | -- == 3 | -- compiled input { 2 } output { 1 } 4 | -- compiled input { 3 } output { 1 } 5 | 6 | def main (x: i32) = #[unsafe] assert (x%2 == 0) (x/2) 7 | -------------------------------------------------------------------------------- /tests/attributes/blank.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- structure { Replicate 1 Screma 0 } 3 | 4 | def main [n] (is: [n]i64) (vs: [n]f64) = 5 | scatter (#[blank] copy (map (+ 1) vs)) is vs 6 | -------------------------------------------------------------------------------- /tests/attributes/noinline0.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- structure { Apply 1 } 3 | 4 | def f (x: i32) = x + 2 5 | 6 | def main x = 7 | #[noinline] f x 8 | -------------------------------------------------------------------------------- /tests/attributes/noinline1.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- structure { Apply 1 } 3 | 4 | def f (x: i64) = x + 2 5 | 6 | def main x = 7 | map (\i -> #[noinline] f i) (iota x) 8 | -------------------------------------------------------------------------------- /tests/attributes/noinline2.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- structure { Apply 1 } 3 | 4 | #[noinline] 5 | def f (x: i32) = x + 2 6 | 7 | def main x = 8 | f x 9 | -------------------------------------------------------------------------------- /tests/attributes/num0.fut: -------------------------------------------------------------------------------- 1 | -- Numeric attributes. Not used for anything here. 2 | 3 | #[1] 4 | #[how_cool(1337)] 5 | def main = true 6 | -------------------------------------------------------------------------------- /tests/attributes/params0.fut: -------------------------------------------------------------------------------- 1 | def main (#[foo] x: bool) = x 2 | -------------------------------------------------------------------------------- /tests/attributes/params1.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { 10 } output { 20 } 3 | 4 | def main (x: i32) = 5 | loop (#[maxval(1337)] acc : i32) = x for i < 10 do x + x 6 | -------------------------------------------------------------------------------- /tests/attributes/scratch.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- structure { Replicate 0 Scratch 1 } 3 | 4 | def main [n] (is: [n]i64) (vs: [n]f64) = 5 | scatter (#[scratch] copy vs) is vs 6 | -------------------------------------------------------------------------------- /tests/attributes/sequential0.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- random input { [10][10]i32 } auto output 3 | -- structure gpu { SegMap 0 Loop 2 } 4 | 5 | def main xss = #[sequential] map i32.sum xss 6 | -------------------------------------------------------------------------------- /tests/attributes/sequential1.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- random input { [10][10]i32 } auto output 3 | -- structure gpu { /SegMap 1 /SegMap/Loop 1 } 4 | 5 | def main xss = map (\xs -> #[sequential] i32.sum xs) xss 6 | -------------------------------------------------------------------------------- /tests/attributes/sequential_inner0.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- random input { [10][10]i32 } auto output 3 | -- structure gpu { /SegMap 1 /SegMap/Loop 1 } 4 | 5 | def main xss = #[sequential_inner] map i32.sum xss 6 | -------------------------------------------------------------------------------- /tests/attributes/sequential_inner1.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- random input { [10][10][10]i32 } auto output 3 | -- structure gpu { /SegMap 1 /SegMap/Loop 1 } 4 | 5 | def main = map (\xss -> #[sequential_inner] map i32.sum xss) 6 | -------------------------------------------------------------------------------- /tests/attributes/sequential_outer0.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- random input { [10][10]i32 } auto output 3 | -- structure gpu { /Loop 1 /Loop/SegRed 1 } 4 | 5 | def main xss = #[sequential_outer] map i32.sum xss 6 | -------------------------------------------------------------------------------- /tests/attributes/unroll2.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] } 3 | -- output { 47 } 4 | -- structure { Loop 0 } 5 | 6 | def main (xs: [10]i32) = 7 | #[unroll] 8 | loop sum = 2 for x in xs do sum + x 9 | -------------------------------------------------------------------------------- /tests/attributes/unroll3.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- structure { Screma 2 } 3 | 4 | def main = 5 | map (\(x: i64) -> 6 | #[unroll] 7 | loop arr = replicate 10 x for i < 20 do 8 | map2 (+) arr (indices arr)) 9 | -------------------------------------------------------------------------------- /tests/attributes/unsafe0.fut: -------------------------------------------------------------------------------- 1 | -- Using unsafe we can avoid a bounds check. 2 | -- 3 | -- == 4 | -- structure { Assert 0 } 5 | 6 | def main(a: []i32, i: i32): i32 = 7 | #[unsafe] a[i] 8 | -------------------------------------------------------------------------------- /tests/attributes/unsafe1.fut: -------------------------------------------------------------------------------- 1 | -- Only one of the accesses should be unsafe. 2 | -- 3 | -- == 4 | -- structure { Assert 1 } 5 | 6 | def main(a: []i32, i: i32, j: i32): (i32,i32) = 7 | (#[unsafe] a[i], a[j]) 8 | -------------------------------------------------------------------------------- /tests/attributes/warn_on_safety_checks0.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- warning: Safety check required 3 | 4 | def main (xs: []f32) i = 5 | #[warn(safety_checks)] 6 | xs[i] 7 | -------------------------------------------------------------------------------- /tests/attributes/warn_on_safety_checks1.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- warning: Safety check required 3 | 4 | def main (xs: []f32) (is: []i32) = 5 | #[warn(safety_checks)] 6 | map (\i -> xs[i]) is 7 | -------------------------------------------------------------------------------- /tests/backtick.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { 2 3 } output { 5 } 3 | 4 | def plus = (i32.+) 5 | 6 | def main (x: i32) (y: i32) = x `plus` y 7 | -------------------------------------------------------------------------------- /tests/badentry10.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { 1i64 [1,2] } 3 | -- output { 1i64 } 4 | -- compiled input { 1i64 [1,2,3] } 5 | -- error: invalid size 6 | 7 | entry main (x: i64) (_: [x+1]i32) = x 8 | -------------------------------------------------------------------------------- /tests/badentry2.fut: -------------------------------------------------------------------------------- 1 | -- This should not warn, even though it is partially applied. 2 | -- == 3 | -- warning: ^$ 4 | def main = reduce (i32.+) 0 5 | -------------------------------------------------------------------------------- /tests/badentry3.fut: -------------------------------------------------------------------------------- 1 | -- It is OK for part of a returned tuple to be opaque. 2 | -- == 3 | -- warning: ^$ 4 | 5 | type opaque [n] = [n](i32, i32) 6 | 7 | def main (x: i32): (opaque [], i32) = ([(x,x)],x) 8 | -------------------------------------------------------------------------------- /tests/badentry4.fut: -------------------------------------------------------------------------------- 1 | -- It is OK to have an array of opaques. 2 | -- == 3 | -- warning: ^$ 4 | 5 | type opaque = {x:i32} 6 | 7 | def main (x: i32): [1]opaque = [{x}] 8 | -------------------------------------------------------------------------------- /tests/badentry8.fut: -------------------------------------------------------------------------------- 1 | -- It is OK to put the type annotations in a higher-order return type. 2 | -- == 3 | -- warning: ^$ 4 | 5 | type t1 = {x:i32} 6 | type t2 = t1 7 | 8 | def main : t1 -> t2 = id 9 | -------------------------------------------------------------------------------- /tests/badentry9.fut: -------------------------------------------------------------------------------- 1 | -- Entry points must use all sizes constructively. 2 | -- == 3 | -- error: \[x\].*constructive 4 | 5 | entry main [x] (_: [x+1]i32) = x 6 | -------------------------------------------------------------------------------- /tests/big1.fut: -------------------------------------------------------------------------------- 1 | -- main 2 | -- == 3 | -- tags { no_gtx780 } 4 | -- no_python no_ispc compiled random input {11264000000i64} auto output 5 | def main (n: i64): i64 = iota n |> reduce (+) 0 6 | -------------------------------------------------------------------------------- /tests/binding-warn0.fut: -------------------------------------------------------------------------------- 1 | -- It is bad to give an argument with a binding that is used in size 2 | -- but it is accepted 3 | -- == 4 | -- warning: with binding 5 | 6 | def f [n] (ns: *[n]i64) = iota (let m = n+2 in m*m) 7 | -------------------------------------------------------------------------------- /tests/binding-warn1.fut: -------------------------------------------------------------------------------- 1 | -- Bad to bind in slices, but accepted 2 | -- == 3 | -- warning: with binding 4 | 5 | def main (n:i64) (xs:*[n]i64) = 6 | let t = iota n 7 | in t[:let m = n-4 in m*m/n] 8 | -------------------------------------------------------------------------------- /tests/bounds-elim0.fut: -------------------------------------------------------------------------------- 1 | -- Optimise away a particularly simple case of bounds checking. 2 | -- == 3 | -- structure { Assert 0 } 4 | 5 | def main [n] (xs: [n]i32) = 6 | loop acc = 0 for i < n do acc + xs[i] 7 | -------------------------------------------------------------------------------- /tests/bounds-elim1.fut: -------------------------------------------------------------------------------- 1 | -- Optimise away another particularly simple case of bounds checking. 2 | -- == 3 | -- structure gpu { SegMap/Assert 0 } 4 | 5 | def main [n] (xs: [n]i32) = 6 | tabulate n (\i -> xs[i] + 2) 7 | -------------------------------------------------------------------------------- /tests/bounds-elim2.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- structure { Assert 0 } 3 | 4 | def main (xs: []i32) = indices xs 5 | -------------------------------------------------------------------------------- /tests/bounds-error0.fut: -------------------------------------------------------------------------------- 1 | -- Test that a trivial runtime out-of-bounds access is caught. 2 | -- == 3 | -- input { [1,2,3] 4 } 4 | -- error: Index \[4\] out of bounds 5 | 6 | def main (a: []i32) (i: i32): i32 = 7 | a[i] 8 | -------------------------------------------------------------------------------- /tests/closedform_loop.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- structure { Screma 1 } 3 | -- structure gpu { SegRed 1 } 4 | 5 | entry main n = f64.sum (replicate n (1/f64.i64 n)) 6 | -------------------------------------------------------------------------------- /tests/concat.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { 3 | -- } 4 | -- output { 5 | -- 6 6 | -- } 7 | def main: i32 = 8 | let a = [(1,(2,3))] 9 | let c = concat a a 10 | let (x,(y,z)) = c[1] in 11 | x+y+z 12 | -------------------------------------------------------------------------------- /tests/concat10.fut: -------------------------------------------------------------------------------- 1 | -- Simplifying away a redundant concat. 2 | -- == 3 | -- structure { Concat 0 } 4 | 5 | def main (xs: []i32) : *[]i32 = 6 | xs ++ [] 7 | -------------------------------------------------------------------------------- /tests/concat11.fut: -------------------------------------------------------------------------------- 1 | -- #1796 2 | -- input { [1,2] } 3 | -- output { [[1, 2], [1, 2], [1, 2], [1, 2], [1, 2]] } 4 | -- structure { Replicate 1 Concat 0 } 5 | 6 | def main (xs: []i32) = 7 | replicate 2 xs ++ replicate 3 xs 8 | -------------------------------------------------------------------------------- /tests/concat3.fut: -------------------------------------------------------------------------------- 1 | -- Fusion of concats. 2 | -- == 3 | -- input { [1] [2] [3] } output { [1,2,3] } 4 | -- structure { Concat 1 } 5 | 6 | def main (xs: []i32) (ys: []i32) (zs: []i32) = 7 | concat xs (concat ys zs) 8 | -------------------------------------------------------------------------------- /tests/concat8.fut: -------------------------------------------------------------------------------- 1 | -- Simplification of concatenations of replicates and array literals. 2 | -- == 3 | -- structure { Replicate 0 ArrayLit 1 Concat 0 } 4 | 5 | def main (a: i32) (b: i32) (c: i32) = 6 | [a] ++ [b] ++ [c] 7 | -------------------------------------------------------------------------------- /tests/constant_folding0.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { 2 } output { 2 } 3 | -- structure { BinOp 0 } 4 | 5 | def main (x: i32) = 6 | ((x - 2) + 1) + 1 7 | -------------------------------------------------------------------------------- /tests/constants/const0-error.fut: -------------------------------------------------------------------------------- 1 | -- Constants are properly type checked. 2 | -- == 3 | -- error: i32 4 | 5 | def x: i32 = 2.0 6 | 7 | def main(): i32 = 2 8 | -------------------------------------------------------------------------------- /tests/constants/const0.fut: -------------------------------------------------------------------------------- 1 | -- Constants work at all. 2 | -- 3 | -- == 4 | -- input {} output { 2 } 5 | 6 | def v: i32 = 2 7 | 8 | def main: i32 = v 9 | -------------------------------------------------------------------------------- /tests/constants/const2.fut: -------------------------------------------------------------------------------- 1 | -- Can value declarations refer to each other? 2 | -- 3 | -- == 4 | -- input { } output { 3 } 5 | 6 | def x: i32 = 2 7 | def y: i32 = x + 1 8 | 9 | def main: i32 = y 10 | -------------------------------------------------------------------------------- /tests/constants/const3.fut: -------------------------------------------------------------------------------- 1 | -- 2 | -- == 3 | -- input { } output { [0,0,0] } 4 | 5 | def n: i64 = 3 6 | 7 | def f(): [n]i32 = replicate n 0 8 | 9 | def main: []i32 = f () 10 | -------------------------------------------------------------------------------- /tests/constants/const5.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- structure { Screma 1 } 3 | 4 | def big_sum = i64.sum (iota 1000000) 5 | 6 | def main b = if b then big_sum - 1 else big_sum + 1 7 | -------------------------------------------------------------------------------- /tests/constants/const6.fut: -------------------------------------------------------------------------------- 1 | def number = 123 + 456 : i64 2 | 3 | def array = iota number 4 | 5 | def sum = i64.sum array 6 | 7 | def main = sum 8 | -------------------------------------------------------------------------------- /tests/constants/const8.fut: -------------------------------------------------------------------------------- 1 | -- Fusion must also happen to constants 2 | -- == 3 | -- structure { Screma 1 } 4 | 5 | def n = 1000 : i64 6 | def x = map (+2) (map (+3) (iota n)) 7 | 8 | def main = x 9 | -------------------------------------------------------------------------------- /tests/cse0.fut: -------------------------------------------------------------------------------- 1 | -- CSE of things that don't look equal at first glance. 2 | -- == 3 | -- input { 1 3 } output { 4 4 } 4 | -- structure { BinOp 1 } 5 | 6 | def main (x: i32) (y: i32) = (x+y, y+x) 7 | -------------------------------------------------------------------------------- /tests/dependence-analysis/jvp0.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- structure { BinOp 2 } 3 | 4 | def main (A: [](i32,i32)) (n: i64) = 5 | let r = 6 | loop A for _i < n do 7 | jvp (map (\(a,b) -> (a*a,b*b))) A A 8 | in map (.0) r 9 | -------------------------------------------------------------------------------- /tests/dependence-analysis/scatter0.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- structure { Replicate 1 } 3 | 4 | def main [n] (A: *[n](i32,i32)) = 5 | let r = 6 | loop A for _i < n do 7 | scatter A (iota n) (copy A) 8 | in map (.0) r 9 | -------------------------------------------------------------------------------- /tests/dependence-analysis/vjp0.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- structure { BinOp 2 } 3 | 4 | def main (A: [](i32,i32)) (n: i64) = 5 | let r = 6 | loop A for _i < n do 7 | vjp (map (\(a,b) -> (a*a,b*b))) A A 8 | in map (.0) r 9 | -------------------------------------------------------------------------------- /tests/distribution/distribution12.fut: -------------------------------------------------------------------------------- 1 | -- A triply nested map should not cause any multi-versioning. 2 | -- == 3 | -- structure gpu { SegMap 1 } 4 | 5 | def main (xsss: [][][]i32) = map (map (map (+1))) xsss 6 | -------------------------------------------------------------------------------- /tests/distribution/distribution3.fut.tuning: -------------------------------------------------------------------------------- 1 | default_threshold=200 2 | -------------------------------------------------------------------------------- /tests/entrycopy0.fut: -------------------------------------------------------------------------------- 1 | -- Entry point result should not be copied. 2 | -- == 3 | -- structure gpu-mem { Replicate 1 } 4 | -- structure seq-mem { Replicate 1 } 5 | 6 | def main b n = 7 | if b then iota n else replicate n 0 8 | -------------------------------------------------------------------------------- /tests/entryexpr.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { [1,2] [3] } 3 | -- output { [1,2,3] } 4 | 5 | def main [n] (xs: [n*2]i32) (ys: [n]i32) = xs ++ ys 6 | -------------------------------------------------------------------------------- /tests/entryval.fut: -------------------------------------------------------------------------------- 1 | -- It is OK for an entry point to not be a function. 2 | -- == 3 | -- input {} output {3.14} 4 | 5 | def main: f64 = 3.14 6 | -------------------------------------------------------------------------------- /tests/enums/enum10.fut: -------------------------------------------------------------------------------- 1 | -- Match on a function. 2 | -- == 3 | -- input { } 4 | -- output { 1 } 5 | 6 | def main : i32 = match (\x -> x + 1) 7 | case y -> 1 8 | -------------------------------------------------------------------------------- /tests/enums/enum14.fut: -------------------------------------------------------------------------------- 1 | -- Constructor order shouldn't matter. 2 | -- == 3 | 4 | type foobar = #foo | #bar 5 | type barfoo = #bar | #foo 6 | 7 | def main (x : foobar) = #bar : barfoo 8 | -------------------------------------------------------------------------------- /tests/enums/enum18.fut: -------------------------------------------------------------------------------- 1 | -- Enum identity function with uniqueness types. 2 | -- == 3 | 4 | def id_unique (x : *[]#foo | #bar) : *[]#foo | #bar = x 5 | -------------------------------------------------------------------------------- /tests/enums/enum19.fut: -------------------------------------------------------------------------------- 1 | -- Matches must have at least one case. 2 | -- == 3 | -- error: 4 | 5 | def x = match 5 6 | -------------------------------------------------------------------------------- /tests/enums/enum33.fut: -------------------------------------------------------------------------------- 1 | -- Missing pattern warning 3. 2 | -- == 3 | -- error: Unmatched 4 | 5 | type foobar = #foo | #bar 6 | 7 | def f : i32 = 8 | match #foo 9 | case (#foo : foobar) -> 1 10 | -------------------------------------------------------------------------------- /tests/enums/enum35.fut: -------------------------------------------------------------------------------- 1 | -- Missing pattern warning 5 (integers). 2 | -- == 3 | -- error: Unmatched 4 | 5 | def f : i32 = 6 | match (1 : i32) 7 | case 1 -> 1 8 | case 2 -> 2 9 | -------------------------------------------------------------------------------- /tests/enums/enum36.fut: -------------------------------------------------------------------------------- 1 | -- Missing pattern warning 6 (floats). 2 | -- == 3 | -- error: 4 | 5 | def f : f32 = 6 | match (1.5 : f32) 7 | case 1.1 -> 1 8 | case 2 -> 2 9 | -------------------------------------------------------------------------------- /tests/enums/enum37.fut: -------------------------------------------------------------------------------- 1 | -- Missing pattern warning 7 (floats). 2 | -- == 3 | -- error: 4 | 5 | def f : i32 = 6 | match {foo = (3.6 : f32), bar = (1 : i32)} 7 | case {foo = 3, bar = y} -> y 8 | -------------------------------------------------------------------------------- /tests/enums/enum38.fut: -------------------------------------------------------------------------------- 1 | -- Missing pattern warning 8 (bool). 2 | -- == 3 | -- error: Unmatched 4 | 5 | def f : bool = 6 | match (true, false) 7 | case (false, true) -> false 8 | -------------------------------------------------------------------------------- /tests/enums/enum42.fut: -------------------------------------------------------------------------------- 1 | -- Ambiguous enums should yield an error. 2 | -- == 3 | -- error: 4 | 5 | def f : bool = 6 | match #foo 7 | case #foo -> true 8 | case #bar -> true 9 | -------------------------------------------------------------------------------- /tests/enums/enum46.fut: -------------------------------------------------------------------------------- 1 | -- The scrutinee of a 'match' expression is fully evaluated before the branches. 2 | -- == 3 | 4 | def main (xs: *[]i32) = 5 | match xs[0] 6 | case 0 -> xs with [0] = 0 7 | case _ -> [0] 8 | -------------------------------------------------------------------------------- /tests/enums/enum47.fut: -------------------------------------------------------------------------------- 1 | -- Do not evaluate branches unnecessarily... 2 | -- == 3 | -- input { 0 } output { 0 } 4 | 5 | def main (x: i32) = 6 | match x case 0 -> 0 7 | case _ -> 2/x 8 | -------------------------------------------------------------------------------- /tests/enums/enum7.fut: -------------------------------------------------------------------------------- 1 | -- Invalid return type with overlapping constructor. 2 | -- == 3 | -- error: 4 | 5 | def g (x : #foo | #bar) : #foo = 6 | match x 7 | case #foo -> #foo 8 | case #bar -> #bar 9 | -------------------------------------------------------------------------------- /tests/enums/enum8.fut: -------------------------------------------------------------------------------- 1 | -- Invalid constructor format. 2 | -- == 3 | -- error: Unexpected token: 'bar' 4 | 5 | type foo = #foo | bar 6 | -------------------------------------------------------------------------------- /tests/enums/issue663.fut: -------------------------------------------------------------------------------- 1 | -- Issue 663. x shouldn't need a type ascription. 2 | -- == 3 | 4 | def main: (bool, #l | #r) = 5 | let x = #l 6 | in (x == x, x) 7 | -------------------------------------------------------------------------------- /tests/errors/duplicate-let-size.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: also bound 3 | 4 | def f (x: []i32) = 5 | let [n] (n: [n]i32) = x 6 | in n 7 | -------------------------------------------------------------------------------- /tests/errors/duplicate-params.fut: -------------------------------------------------------------------------------- 1 | -- Using the same parameter name twice is forbidden. 2 | -- 3 | -- == 4 | -- error: also bound 5 | 6 | def main (x: i32) (x: i32): i32 = x 7 | -------------------------------------------------------------------------------- /tests/errors/duplicate-size-params.fut: -------------------------------------------------------------------------------- 1 | -- Using the same parameter name twice is forbidden, even when one use 2 | -- is as a size parameter. 3 | -- 4 | -- == 5 | -- error: also bound 6 | 7 | def f [m] (m:[m]i64) = m 8 | -------------------------------------------------------------------------------- /tests/errors/duplicate-type-params.fut: -------------------------------------------------------------------------------- 1 | -- Using the same type parameter name twice is forbidden. 2 | -- 3 | -- == 4 | -- error: also bound 5 | 6 | def f 'a 'a (x: a) = x 7 | -------------------------------------------------------------------------------- /tests/errors/duplicate-vars.fut: -------------------------------------------------------------------------------- 1 | -- Using the same name twice in a single pattern is forbidden. 2 | -- 3 | -- == 4 | -- error: also bound 5 | 6 | def main (x: i32): (i32,i32) = 7 | let (y,y) = (x-1, x+1) 8 | in (y,y) 9 | -------------------------------------------------------------------------------- /tests/errors/missing-in.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Unexpected end of file 3 | 4 | def main (x:i32): f32 = 5 | let f_ = map f (1.. xs) (iota n) 4 | else let largest = xs[0] 5 | in map (\_ -> iota largest) (iota (largest - 1)) 6 | -------------------------------------------------------------------------------- /tests/f16kernel.fut: -------------------------------------------------------------------------------- 1 | -- Can we correctly have a free variable of type f16 inside a parallel 2 | -- construct? 3 | -- == 4 | -- input { [1f16,2f16] 3f16} auto output 5 | 6 | def main (xs: []f16) (y: f16) = map (+y) xs 7 | -------------------------------------------------------------------------------- /tests/flattening/flattening-pipeline: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | futhark -s --flattening -i "$1" 3 | -------------------------------------------------------------------------------- /tests/floatunderscores.fut: -------------------------------------------------------------------------------- 1 | -- Floats can contain underscores 2 | -- == 3 | -- input { 123_.456f32 } 4 | -- output { 100000.123456f32 } 5 | 6 | def main (_: f32) = 7 | 100_000.123_456f32 8 | -------------------------------------------------------------------------------- /tests/funcall-error0.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Cannot apply expression as function 3 | 4 | def main = true 3 5 | -------------------------------------------------------------------------------- /tests/fusion/fusion7.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- structure { Screma 1 } 3 | 4 | let main (is: []i32) (xs: []i32) = 5 | let foo = (map (+1) xs)[0] 6 | let bar = (map (+2) xs)[0] 7 | in (foo, bar) 8 | -------------------------------------------------------------------------------- /tests/fusion/horizontal0.fut: -------------------------------------------------------------------------------- 1 | -- No fusion of this, because the arrays are independent. 2 | -- == 3 | -- structure { Screma 2 } 4 | 5 | def main [n] (x: [n]i32) (y: [n]i32) = (map (+1) x, map (+2) y) 6 | -------------------------------------------------------------------------------- /tests/fusion/noFusion4.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | def main(arr: *[]f64): f64 = 3 | let x = map (+1.0) arr 4 | let arr[1] = 3.33 5 | let y = map (*2.0) x in 6 | y[0] + arr[1] 7 | -------------------------------------------------------------------------------- /tests/fusion/red-red-fusion.fut: -------------------------------------------------------------------------------- 1 | -- Horizontal fusion of reductions. 2 | -- == 3 | -- structure { Screma 1 } 4 | 5 | def main (xs: []i32) = (i32.sum xs, f32.sum (map f32.i32 xs)) 6 | -------------------------------------------------------------------------------- /tests/fusion/slicemap1.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- structure { Screma 1 } 3 | 4 | def main (xs: []i32) = 5 | map (+3) ((map (+2) xs)[::2]) 6 | -------------------------------------------------------------------------------- /tests/fusion/slicemap3.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { [[1,2,3],[4,5,6],[7,8,9]] } output { [[9, 15], [27, 33]] } 3 | -- structure gpu { Index 1 } 4 | 5 | def main (xs: [][]i32) = map (map (*3)) ((map (map (+2)) xs)[::2,::2]) 6 | -------------------------------------------------------------------------------- /tests/fusion/slicemap4.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- structure { Screma 1 } 3 | 4 | def main (xs: []i32) = xs |> map (+2) |> reverse |> map (*3) 5 | -------------------------------------------------------------------------------- /tests/globalsize0.fut: -------------------------------------------------------------------------------- 1 | -- #1920 2 | 3 | def n = 3i64 4 | 5 | def bar f = f { xs = replicate n 0f32 } 6 | 7 | def main = bar id 8 | -------------------------------------------------------------------------------- /tests/higher-order-functions/alias0.fut: -------------------------------------------------------------------------------- 1 | -- Yet another case of aliasing that can result in incorrect code 2 | -- generation. 3 | 4 | def main (w: i64) (h: i64) = 5 | ([1,2,3] :> [w*h]i32) |> unflatten 6 | -------------------------------------------------------------------------------- /tests/higher-order-functions/alias1.fut: -------------------------------------------------------------------------------- 1 | -- Yet another case of aliasing that can result in incorrect code 2 | -- generation. 3 | 4 | def main [m][n] (xi_0: [m][n]f32) (xi_1: [m][n]f32) = 5 | map2 zip xi_0 xi_1 6 | -------------------------------------------------------------------------------- /tests/higher-order-functions/higher-order-entry-point1.fut: -------------------------------------------------------------------------------- 1 | -- Curried entry point. 2 | -- == 3 | -- input { 2 2 } output { 4 } 4 | 5 | def plus (x: i32) (y: i32) = x + y 6 | 7 | def main (x: i32) = plus x 8 | -------------------------------------------------------------------------------- /tests/higher-order-functions/higher-order0.fut: -------------------------------------------------------------------------------- 1 | -- id id id ... 2 | -- == 3 | -- input { 378 } output { 378 } 4 | 5 | def id '^a (x : a) : a = x 6 | 7 | def main (x : i32) = id id id id x 8 | -------------------------------------------------------------------------------- /tests/higher-order-functions/localfunction0.fut: -------------------------------------------------------------------------------- 1 | -- The defunctionaliser once messed up local closures. 2 | 3 | def main (n: i64) = 4 | let scale (x: i64) (y: i64) = (x+y) / n 5 | in map (scale 1) (iota n) 6 | -------------------------------------------------------------------------------- /tests/higher-order-functions/shape-params4.fut: -------------------------------------------------------------------------------- 1 | type^ f = (n: i64) -> [n]i32 2 | 3 | def main: f = \n -> replicate n 0 4 | -------------------------------------------------------------------------------- /tests/higher-order-functions/uniqueness11.fut: -------------------------------------------------------------------------------- 1 | def main = map (const (iota 3 with [0] = 1)) (iota 3) 2 | -------------------------------------------------------------------------------- /tests/hist/fusion.fut: -------------------------------------------------------------------------------- 1 | -- 2 | -- == 3 | -- structure { Screma 0 Hist 1 } 4 | 5 | def main [m][n] (hist : *[n]i32, image : [m]i32) : [n]i32 = 6 | reduce_by_index hist (+) 0 (map i64.i32 image) (map (+2) image) 7 | -------------------------------------------------------------------------------- /tests/holes/hof0.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input {0i64} error: hole 3 | 4 | def main (x: i64) : bool = ??? x x 5 | -------------------------------------------------------------------------------- /tests/holes/hof1.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input {0i64} error: hole 3 | 4 | def main (x: i64) : bool = ??? (+1) x 5 | -------------------------------------------------------------------------------- /tests/holes/hof2.fut: -------------------------------------------------------------------------------- 1 | -- Based on #1738. 2 | -- == 3 | -- input { 0f32 } error: hole.*hof2.fut:7 4 | 5 | def f a b : f32 = a + b 6 | 7 | entry main y : f32 = (let x = y in f x) ??? 8 | -------------------------------------------------------------------------------- /tests/holes/hof3.fut: -------------------------------------------------------------------------------- 1 | -- From #1885 2 | 3 | def f : (x: i64) -> []i64 = ??? 4 | 5 | entry main x = f x 6 | -------------------------------------------------------------------------------- /tests/holes/loop1.fut: -------------------------------------------------------------------------------- 1 | -- Loop optimisation should not eliminate holes. 2 | -- == 3 | -- input { 0i32 } error: hole 4 | 5 | def holey (x: i32) : i32 = ??? 6 | 7 | def main (x: i32) = loop acc = holey x for i < x do acc 8 | -------------------------------------------------------------------------------- /tests/holes/simple0.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input {0i32} error: hole 3 | 4 | def main (x: i32) : i32 = ??? : i32 5 | -------------------------------------------------------------------------------- /tests/holes/simple1.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input {0i64} error: hole 3 | 4 | def main (x: i64) : *[x]i32 = ??? 5 | -------------------------------------------------------------------------------- /tests/holes/simple2.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input {true} output { [1,2,3] } 3 | -- input {false} error: hole 4 | 5 | def main (b: bool) = if b then [1,2,3] else ??? 6 | -------------------------------------------------------------------------------- /tests/holes/simple3.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: causality 3 | 4 | def main (b: bool) (A: []i32) = 5 | if b then filter (>0) A else ??? 6 | -------------------------------------------------------------------------------- /tests/holes/simple4.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Ambiguous size.*instantiated size parameter of "f32.sum" 3 | 4 | def main = f32.sum ??? 5 | -------------------------------------------------------------------------------- /tests/holes/simple5.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: size-polymorphic 3 | 4 | def main (b: bool) : []i32 = ??? 5 | -------------------------------------------------------------------------------- /tests/holes/simple6.fut: -------------------------------------------------------------------------------- 1 | def f (x: f32) : f32 = ??? 2 | def main (bs:f32) = f bs 3 | -------------------------------------------------------------------------------- /tests/if0.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: bool 3 | 4 | def main (x: i32) = 5 | if x then true else false 6 | -------------------------------------------------------------------------------- /tests/if1.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: i32.*i16 3 | 4 | def main b = 5 | if b then 2i32 else 2i16 6 | -------------------------------------------------------------------------------- /tests/include_basic_includee.fut: -------------------------------------------------------------------------------- 1 | def importe_function(t: i32): i32 = t * 4 2 | -------------------------------------------------------------------------------- /tests/include_many_includee0.fut: -------------------------------------------------------------------------------- 1 | open (import "include_many_includee0_includee") 2 | 3 | def includee0_function(x: i32): i32 = includee0_includee_function(x * 3) 4 | -------------------------------------------------------------------------------- /tests/include_many_includee0_includee.fut: -------------------------------------------------------------------------------- 1 | def includee0_includee_function(x: i32): i32 = x - 3 2 | -------------------------------------------------------------------------------- /tests/include_many_includee1.fut: -------------------------------------------------------------------------------- 1 | def includee1_function(x: i32): i32 = x + 6 2 | -------------------------------------------------------------------------------- /tests/index12.fut: -------------------------------------------------------------------------------- 1 | -- Simplifying away a slice of a rotate is not so simple. 2 | -- == 3 | -- input { [1,2,3] } 4 | -- output { [3,1] } 5 | 6 | def main (xs: []i32) = 7 | let ys = rotate (-1) xs 8 | in ys[0:2] 9 | -------------------------------------------------------------------------------- /tests/index13.fut: -------------------------------------------------------------------------------- 1 | def f (xs: []([]i32,[]i32)) = xs[0] 2 | 3 | def main xs ys = f (zip xs ys) 4 | -------------------------------------------------------------------------------- /tests/index14.fut: -------------------------------------------------------------------------------- 1 | def f (A: []([](i32,i32), [](i32,i32))) = A[0].1 2 | 3 | entry main (A: *[]([](i32,i32), [](i32,i32))) = 4 | f A with [0] = (0,0) 5 | -------------------------------------------------------------------------------- /tests/intragroup/reduce1.fut.tuning: -------------------------------------------------------------------------------- 1 | default_threshold=200 2 | -------------------------------------------------------------------------------- /tests/intragroup/reduce2.fut.tuning: -------------------------------------------------------------------------------- 1 | default_threshold=200 2 | -------------------------------------------------------------------------------- /tests/intragroup/replicate0.fut.tuning: -------------------------------------------------------------------------------- 1 | default_threshold=200 2 | -------------------------------------------------------------------------------- /tests/intragroup/replicate1.fut.tuning: -------------------------------------------------------------------------------- 1 | default_threshold=200 2 | -------------------------------------------------------------------------------- /tests/intragroup/scan0.fut.tuning: -------------------------------------------------------------------------------- 1 | default_threshold=200 2 | -------------------------------------------------------------------------------- /tests/intragroup/scan1.fut.tuning: -------------------------------------------------------------------------------- 1 | default_threshold=200 2 | -------------------------------------------------------------------------------- /tests/intragroup/scan2.fut.tuning: -------------------------------------------------------------------------------- 1 | default_threshold=200 2 | -------------------------------------------------------------------------------- /tests/intragroup/segreduce0.fut.tuning: -------------------------------------------------------------------------------- 1 | default_threshold=200 2 | -------------------------------------------------------------------------------- /tests/intragroup/segreduce1.fut.tuning: -------------------------------------------------------------------------------- 1 | default_threshold=200 2 | -------------------------------------------------------------------------------- /tests/intragroup/segreduce2.fut.tuning: -------------------------------------------------------------------------------- 1 | default_threshold=200 2 | -------------------------------------------------------------------------------- /tests/intragroup/stencil_1d.fut.tuning: -------------------------------------------------------------------------------- 1 | default_threshold=200 2 | -------------------------------------------------------------------------------- /tests/intragroup/stencil_2d.fut.tuning: -------------------------------------------------------------------------------- 1 | default_threshold=200 2 | -------------------------------------------------------------------------------- /tests/intragroup/toomuch.fut.tuning: -------------------------------------------------------------------------------- 1 | default_threshold=200 2 | -------------------------------------------------------------------------------- /tests/intunderscores.fut: -------------------------------------------------------------------------------- 1 | -- Integers can contain underscores 2 | -- == 3 | -- input { 123_456 } 4 | -- output { 101000i32 } 5 | 6 | def main (x: i32) = 7 | let x = 100_000i32 8 | in x + i32.i16(1_000i16) 9 | -------------------------------------------------------------------------------- /tests/iota0.fut: -------------------------------------------------------------------------------- 1 | -- Does iota work at all? 2 | -- == 3 | -- input { 0i64 } 4 | -- output { empty([0]i64) } 5 | -- input { 2i64 } 6 | -- output { [0i64,1i64] } 7 | 8 | def main(n: i64): []i64 = iota(n) 9 | -------------------------------------------------------------------------------- /tests/issue1043.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: aliased to "xs" 3 | 4 | def f 'a 'b (f: a -> b) (xs: a) = 5 | f xs 6 | 7 | def main (xs: []i32) : *[]i32 = 8 | (`f`xs) id 9 | -------------------------------------------------------------------------------- /tests/issue1153.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Default 3 | 4 | def example a b = a + b 5 | 6 | def example2 a = example a 1.0 7 | -------------------------------------------------------------------------------- /tests/issue1194.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { 8i64 } output { 511i64 } 3 | 4 | def main (n: i64) = 5 | loop i = 0 for d in n..n-1...0 do 6 | i + (1 << n - d) 7 | -------------------------------------------------------------------------------- /tests/issue1222.fut: -------------------------------------------------------------------------------- 1 | def main [h][w] (n: i64) (image: *[h][w]i32) : [h][w]i32 = 2 | image with [:, :w-1] = (copy image)[:,1:] 3 | -------------------------------------------------------------------------------- /tests/issue1231.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: importe_function 3 | 4 | import "include_basic" 5 | 6 | def main x = importe_function x 7 | -------------------------------------------------------------------------------- /tests/issue1240.fut: -------------------------------------------------------------------------------- 1 | def main: []i64 = 2 | [0] ++ loop s = [] 3 | for _i < 2 4 | do s ++ [0] 5 | -------------------------------------------------------------------------------- /tests/issue1242.fut: -------------------------------------------------------------------------------- 1 | def hof [n] (f: i64 -> i64) (irf: [n]f32) (b: bool) = n 2 | 3 | def main [n][m] (irf: [n]f32) (bs: [m]bool) = 4 | map (hof id irf) bs 5 | -------------------------------------------------------------------------------- /tests/issue1294.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: array element 3 | 4 | def apply 'a '~b (f: i64 -> a -> b) (x: a) = 5 | [f 0 x, f 1 x] 6 | 7 | def main (x: i32) = apply replicate x 8 | -------------------------------------------------------------------------------- /tests/issue1302.fut: -------------------------------------------------------------------------------- 1 | def arr = replicate 10 true 2 | def main x = copy arr with [0] = x 3 | -------------------------------------------------------------------------------- /tests/issue1326.fut: -------------------------------------------------------------------------------- 1 | def f n = iota (n + 1) 2 | entry a = f 10 3 | entry b = a 4 | -------------------------------------------------------------------------------- /tests/issue1332.fut: -------------------------------------------------------------------------------- 1 | def main (n: i64) (xs: []i32) = 2 | (.[::n - 1]) xs 3 | -------------------------------------------------------------------------------- /tests/issue1345.fut: -------------------------------------------------------------------------------- 1 | entry sqrt32 (x: bool) = x 2 | -------------------------------------------------------------------------------- /tests/issue1358.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | 3 | def main [n] b (xs: *[n]i32) = 4 | let vals = map (+2) (if b then reverse xs else xs) 5 | in scatter xs (iota n) vals 6 | -------------------------------------------------------------------------------- /tests/issue1455.fut: -------------------------------------------------------------------------------- 1 | entry test [n] (xs: *[n]i32) : (*[]i32, *[]i32) = 2 | let a = [0] 3 | let cp = loop a for i < n do 4 | copy xs[i:i+1] 5 | in (cp, xs) 6 | -------------------------------------------------------------------------------- /tests/issue1457.fut: -------------------------------------------------------------------------------- 1 | def main [n][m] (xs: *[n][m]f64) = 2 | #[unsafe] 3 | let (a, b) = unzip (tabulate m (\i -> (f64.sqrt (f64.i64 i), f64.cos (f64.i64 i)))) 4 | let xs[0] = a 5 | let xs[1] = b 6 | in (a, xs) 7 | -------------------------------------------------------------------------------- /tests/issue1478.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Entry points 3 | 4 | module mmain = { 5 | entry f x = x + 1 6 | } 7 | entry f x = mmain.f x 8 | -------------------------------------------------------------------------------- /tests/issue1492.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Unexpected "def" 3 | 4 | def f x = 5 | let x' = x + 2 6 | 7 | def g x = 8 | let x' = x * 2 9 | in x 10 | -------------------------------------------------------------------------------- /tests/issue1499.fut: -------------------------------------------------------------------------------- 1 | def f (xs: *[][]bool) = 2 | #[unsafe] 3 | let a = xs[0] 4 | let b = copy a 5 | let xs[0,1] = true 6 | in (b[0], xs[0,0]) 7 | 8 | def main A = map (\xs -> f (copy xs)) A 9 | -------------------------------------------------------------------------------- /tests/issue1505.fut: -------------------------------------------------------------------------------- 1 | def main n b = 2 | let xs = replicate n 0 3 | let xs' = if b then loop xs = copy xs for i < 10 do xs with [i] = 0 else xs 4 | in if b then xs else xs' 5 | -------------------------------------------------------------------------------- /tests/issue1525.fut: -------------------------------------------------------------------------------- 1 | def main s = 2 | [0,1] |> map (\c -> (c...(c+1)) |> map(\k -> s[k]) |> reduce (+) 0) 3 | -------------------------------------------------------------------------------- /tests/issue1531.fut: -------------------------------------------------------------------------------- 1 | type~ t0 = ?[n][m].([n]i64, [m]i64) 2 | 3 | type~ t1 = (t0, t0) 4 | 5 | def main: t1 = 6 | let a = (iota 1, iota 2) 7 | let b = (iota 3, iota 4) 8 | in (a, b) 9 | -------------------------------------------------------------------------------- /tests/issue1535.fut: -------------------------------------------------------------------------------- 1 | type sumType = #some ([0]i32) | #none 2 | entry main = 3 | (\(x: sumType) -> 4 | match x 5 | case (#some y) -> id y 6 | case _ -> []) 7 | (#none: sumType) 8 | -------------------------------------------------------------------------------- /tests/issue1546.fut: -------------------------------------------------------------------------------- 1 | let main (b: bool) (i: i64) (xs: []i64) = 2 | #[unsafe] 3 | if b then (iota xs[i+1],xs[0::2]) else (xs[0::2],iota xs[i+1]) 4 | -------------------------------------------------------------------------------- /tests/issue1552.fut: -------------------------------------------------------------------------------- 1 | type T 'a = i64 2 | 3 | let f 'a (x: T a): T a = x 4 | 5 | let main = f 6 | -------------------------------------------------------------------------------- /tests/issue1557.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Cannot unify 3 | 4 | def get (cond: bool): #a = 5 | if cond then #a else 0 6 | -------------------------------------------------------------------------------- /tests/issue1572.fut: -------------------------------------------------------------------------------- 1 | let main xss = 2 | map (\(xs: []i32) -> 3 | loop xs = zip (copy xs) (copy xs) 4 | for i < 10 do xs with [0] = (xs[0].1 + 1,2)) 5 | xss 6 | -------------------------------------------------------------------------------- /tests/issue1599.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Occurs 3 | 4 | let bad a f = f a f 5 | -------------------------------------------------------------------------------- /tests/issue1615.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- structure { Update 1 } 3 | 4 | def main (A: *[3]i32) : *[3]i32 = 5 | let x = (id A)[2] 6 | in A with [1] = x 7 | -------------------------------------------------------------------------------- /tests/issue1628.fut: -------------------------------------------------------------------------------- 1 | def main b (xs: *[2][3]i64) = 2 | let v = if b then iota 3 else copy xs[1] 3 | in xs with [0] = v 4 | -------------------------------------------------------------------------------- /tests/issue1631.fut: -------------------------------------------------------------------------------- 1 | -- Problem was that this loop was mistakenly turned into a stream. 2 | let main = 3 | let go _ = loop _ = [] for _ in [0,1] do [0i32] 4 | in (go 0, go 1) 5 | -------------------------------------------------------------------------------- /tests/issue1700.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { empty([0][2]i32) } 3 | -- output { empty([0]i32) } 4 | 5 | def main (xs: [][]i32) = 6 | (transpose xs)[0] 7 | -------------------------------------------------------------------------------- /tests/issue1711.fut: -------------------------------------------------------------------------------- 1 | def test = 2 | let x = [1, 2, 3, 4, 5] in 3 | let y = x |> map (\x -> x + x) with [0] = 10 in 4 | y |> i64.sum |> (+ 10) 5 | -------------------------------------------------------------------------------- /tests/issue1749.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Consuming.*"empty" 3 | 4 | module Test = { 5 | let empty = [] 6 | } 7 | 8 | let consume (arr: *[]i64) = arr 9 | 10 | entry main (_: bool) = consume Test.empty 11 | -------------------------------------------------------------------------------- /tests/issue1753.fut: -------------------------------------------------------------------------------- 1 | def main (xss: [][]i32) vs = 2 | map (\xs -> map (\v -> copy xs with [0] = v) vs) xss 3 | -------------------------------------------------------------------------------- /tests/issue1757.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { -5 } error: y > 0 3 | 4 | def main (x: i32) = 5 | let y = x + 2 6 | let z = assert (y>0) (x+2) 7 | in y+z 8 | -------------------------------------------------------------------------------- /tests/issue1758.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { 10i64 } 3 | -- error: issue1758.fut:8 4 | 5 | let main (i: i64): [i]i64 = 6 | let a = iota i 7 | let b = replicate i 0 8 | in a with [:4] = b 9 | -------------------------------------------------------------------------------- /tests/issue1787.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: found to be functional 3 | 4 | entry main: i32 -> i32 -> i32 = 5 | ((true, (.0)), (false, (.1))) 6 | |> (\p -> if p.0.0 then p.0 else p.1) 7 | |> (.1) 8 | |> curry 9 | -------------------------------------------------------------------------------- /tests/issue1791.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- structure gpu { SegRed 1 } 3 | 4 | entry main [n] [d] (as: [n][d]f32) : [3]f32 = 5 | let bs = replicate n 0 6 | let f i = f32.sum as[i] + 1 + bs[i] 7 | in tabulate 3 f 8 | -------------------------------------------------------------------------------- /tests/issue1806.fut: -------------------------------------------------------------------------------- 1 | type record = {ctx: i64, foo': i64} 2 | 3 | entry main(r: record): record = r with ctx = 1 4 | -------------------------------------------------------------------------------- /tests/issue1808.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { [1,2,3] } 3 | -- output { [1,2,3,1,2,3] } 4 | 5 | def main (xs: []i32) = 6 | let [m] ys : [m]i32 = xs ++ xs 7 | in map (\i -> ys[i]) (iota m) 8 | -------------------------------------------------------------------------------- /tests/issue1816.fut: -------------------------------------------------------------------------------- 1 | type rec3 = {x: [2]i32, y: i32} 2 | let mod3 (r: *rec3): *rec3 = r 3 | -------------------------------------------------------------------------------- /tests/issue1824.fut: -------------------------------------------------------------------------------- 1 | def x !! y = x && y 2 | 3 | def x += y = x + y 4 | 5 | def x =+ y = x + y 6 | -------------------------------------------------------------------------------- /tests/issue1863.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { empty([1][0]i32) } 3 | -- output { [0i32] } 4 | 5 | def main (foo: [1][0]i32): [1]i32 = 6 | map2 (\_ _ -> 0) [0] foo 7 | -------------------------------------------------------------------------------- /tests/issue1935.fut: -------------------------------------------------------------------------------- 1 | def get_name (i: i64) = 2 | match i 3 | case 0 -> "some name" 4 | case _ -> "" 5 | 6 | entry main = 7 | loop i = 0 8 | while length (get_name i) != 0 9 | do i + 1 10 | -------------------------------------------------------------------------------- /tests/issue1936.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- tags { no_wasm } 3 | -- compiled random input { f32 } 4 | 5 | def main (x: f32) = (x, (), replicate 10 ()) 6 | -------------------------------------------------------------------------------- /tests/issue1937.fut: -------------------------------------------------------------------------------- 1 | def iiota [n] : [n]i64 = 0..1.. take k (drop i s)) (take (length s - k) (indices s)) 3 | 4 | entry main (s: []i32) = windows 14 s 5 | -------------------------------------------------------------------------------- /tests/issue1949.fut: -------------------------------------------------------------------------------- 1 | def fn (arr: *[](i32,i32)) = 2 | if true then opaque arr else opaque arr 3 | 4 | entry test = (fn [(0, 0)])[0] 5 | -------------------------------------------------------------------------------- /tests/issue1952.fut: -------------------------------------------------------------------------------- 1 | entry main (x: i64) = 2 | let is = flatten [[x], [x]] 3 | in 4 | is[999999999] 5 | -------------------------------------------------------------------------------- /tests/issue1978.fut: -------------------------------------------------------------------------------- 1 | entry main (gridDim: (i64,i64)) = 2 | tabulate_2d gridDim.0 gridDim.1 (\i j -> (i, j)) 3 | |> flatten 4 | -------------------------------------------------------------------------------- /tests/issue1984.fut: -------------------------------------------------------------------------------- 1 | -- #19 2 | -- == 3 | -- input { true [1,2,3] } output { [1,2,3] } 4 | -- input { false [1,2,3] } output { [3,2,1] } 5 | 6 | def main b (xs: []i32) = if b then xs else reverse xs 7 | -------------------------------------------------------------------------------- /tests/issue2000.fut: -------------------------------------------------------------------------------- 1 | entry main (x: i32) (y: i32): bool = 2 | match x 3 | case x' -> (\z -> z == x') y 4 | -------------------------------------------------------------------------------- /tests/issue2011.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input {} 3 | -- output { 4u64 } 4 | 5 | module mod: {module x: integral} = { 6 | module x = u64 7 | } 8 | 9 | def main = u64.i64 4 10 | -------------------------------------------------------------------------------- /tests/issue2017.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Refutable 3 | 4 | def a - 1 = 2 5 | -------------------------------------------------------------------------------- /tests/issue2018.fut: -------------------------------------------------------------------------------- 1 | def main (i: i64) (j: i64) (xss: *[][]i32) = 2 | let xs = xss[i] 3 | let xss[j] = copy (opaque (opaque xs)) 4 | in xss 5 | -------------------------------------------------------------------------------- /tests/issue2021.fut: -------------------------------------------------------------------------------- 1 | def arr = replicate 10 true 2 | entry main : [](bool,bool) = zip arr arr 3 | -------------------------------------------------------------------------------- /tests/issue2048.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { [1,2,3] } 3 | -- output { 3i64 } 4 | 5 | def f [n] (xs: [n]i32) = 6 | let [m] (ys: [m]i32) = filter (>0) xs 7 | in ys 8 | 9 | entry main xs = length (f xs) 10 | -------------------------------------------------------------------------------- /tests/issue2058.fut: -------------------------------------------------------------------------------- 1 | -- We neglected to mark the target arrays as consumed while 2 | -- simplifying the body. 3 | 4 | entry problem [n] (arr: *[n]i64) : [n]i64 = 5 | reduce_by_index arr (+) 0 (iota n) (copy arr) 6 | -------------------------------------------------------------------------------- /tests/issue2099.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input {} 3 | -- output { [100, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9] 11i64 } 4 | 5 | def numbers = concat [100] (0..<10i32) 6 | entry main = (numbers, length numbers) 7 | -------------------------------------------------------------------------------- /tests/issue2103.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: cannot match 3 | 4 | def main = 5 | let [n] (A: [n]i64, B: [n]i64) = (iota 1, iota 2) 6 | in zip A B 7 | -------------------------------------------------------------------------------- /tests/issue2113.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: "a" 3 | 4 | module type abc = { 5 | type x 'a 6 | val y : x a 7 | } 8 | -------------------------------------------------------------------------------- /tests/issue2114.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: "t" 3 | 4 | module type A = { 5 | module R : { type t = t } 6 | } 7 | -------------------------------------------------------------------------------- /tests/issue2124.fut: -------------------------------------------------------------------------------- 1 | -- Ignore suffixes when computing differences when possible. 2 | 3 | def main b : [10]i64 = 4 | if b then iota 10 : [10]i64 5 | else iota 10i64 : [10]i64 6 | -------------------------------------------------------------------------------- /tests/issue2136.fut: -------------------------------------------------------------------------------- 1 | def test (a: i64) (b: i64) (f: [a*b]f32 -> [a*b]f32) (g: [a*b]f32 -> [a*b]f32) = 2 | g (f (replicate (a*b) 0)) 3 | 4 | entry main a b = 5 | let h = test a b 6 | in h reverse reverse 7 | -------------------------------------------------------------------------------- /tests/issue2193.fut: -------------------------------------------------------------------------------- 1 | def takefrom 't (xs: []t) (i: i64) : [i+1]t = take (i+1) xs 2 | 3 | entry main n (xs: []i32) = 4 | n |> takefrom xs 5 | -------------------------------------------------------------------------------- /tests/issue2231_a.fut: -------------------------------------------------------------------------------- 1 | type t = () 2 | 3 | entry a (x: []t) : i32 = 0 4 | 5 | entry b (x: *[]t) : i32 = 0 6 | -------------------------------------------------------------------------------- /tests/issue2231_b.fut: -------------------------------------------------------------------------------- 1 | type t = () 2 | 3 | entry c (a: []t) (b: *[]t) : i32 = 0 4 | -------------------------------------------------------------------------------- /tests/issue367.fut: -------------------------------------------------------------------------------- 1 | def main(n: i64) = 2 | let a = replicate n (replicate n 1) 3 | in map (\(xs: []i32, i) -> copy xs with [0] = i32.i64 i) (zip a (iota n)) 4 | -------------------------------------------------------------------------------- /tests/issue403.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { [1,2] 0 } output { true } 3 | -- input { [1,2] 1 } output { false } 4 | 5 | def main (xs: *[]i32) (i: i32) = 6 | let xs[0] = 0 7 | in xs[i] == 0 8 | -------------------------------------------------------------------------------- /tests/issue413.fut: -------------------------------------------------------------------------------- 1 | module vec: { type vec [x] } = { 2 | type vec [x] = [x]i32 3 | } 4 | 5 | def main [n] ((x: vec.vec[n]): vec.vec[n]) = 0 6 | -------------------------------------------------------------------------------- /tests/issue426.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { [1,2] [2,1] } 3 | -- output { true } 4 | 5 | def main (xs: []i32) (ys: []i32) = xs != ys 6 | -------------------------------------------------------------------------------- /tests/issue433.fut: -------------------------------------------------------------------------------- 1 | -- The bug here was related to the replicate. 2 | 3 | def main = replicate 0 ([] : [](i32,i32)) 4 | -------------------------------------------------------------------------------- /tests/issue473.fut: -------------------------------------------------------------------------------- 1 | -- Projecting an array index should be permitted. 2 | -- == 3 | -- input { 0 } 4 | -- output { 0 } 5 | 6 | def main (x: i32) = let a = [(x,x)] in a[0].0 7 | -------------------------------------------------------------------------------- /tests/issue481.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { [[[1,2], [3,4]], [[2,1], [4,3]]] } 3 | -- output { [[[1,3], [2,4]], [[2,4], [1,3]]] } 4 | 5 | def main (xsss: [][][]i32): *[][][]i32 = map transpose xsss 6 | -------------------------------------------------------------------------------- /tests/issue512.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { [1i64,2i64,3i64] } output { 4i64 } 3 | 4 | def apply 'a (f: a -> a) (x: a) = f x 5 | 6 | def f [n] (xs: [n]i64) (x: i64) = n + x 7 | 8 | def main (xs: []i64) = apply (f xs) 1 9 | -------------------------------------------------------------------------------- /tests/issue514.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: issue514.fut:4:26-36 3 | 4 | def main = (2.0 + 3.0) / (2 + 3i32) 5 | -------------------------------------------------------------------------------- /tests/issue522.fut: -------------------------------------------------------------------------------- 1 | def main (b: bool) (xs: []i32) = 2 | if b then xs else [] 3 | -------------------------------------------------------------------------------- /tests/issue527.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { 2 } output { 2 } 3 | 4 | def id 'a (x: a) : a = x 5 | def main (x: i32) = let r = { id } 6 | in r.id x 7 | -------------------------------------------------------------------------------- /tests/issue541.fut: -------------------------------------------------------------------------------- 1 | def f = \x -> let h y = y 2 | in h x 3 | 4 | entry main1 (x: i32) = f x + f x 5 | -------------------------------------------------------------------------------- /tests/issue544.fut: -------------------------------------------------------------------------------- 1 | -- This used to produce an unnecessarily unique return type on a 2 | -- lifted function. 3 | 4 | def main = 5 | ((\x -> x) <-< (\x -> x)) [1,2,3] 6 | -------------------------------------------------------------------------------- /tests/issue560.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { [[[1,2], [3,4]],[[5,6],[7,8]]] } 3 | -- output { [[[1i32, 2i32], [5i32, 6i32]], [[3i32, 4i32], [7i32, 8i32]]] } 4 | 5 | def main (matb: [][][]i32) = transpose matb 6 | -------------------------------------------------------------------------------- /tests/issue567.fut: -------------------------------------------------------------------------------- 1 | -- Infinite loops should not crash the compiler. 2 | 3 | def main (x: i32) = loop x while true do x+1 4 | -------------------------------------------------------------------------------- /tests/issue573.fut: -------------------------------------------------------------------------------- 1 | def main (a: *[8]f32) : *[8]f32 = 2 | a with [:] = copy a 3 | -------------------------------------------------------------------------------- /tests/issue593.fut: -------------------------------------------------------------------------------- 1 | -- The usual problems with identity mapping. 2 | 3 | def main (xss: [][]i32) (ys: []i32) = 4 | let (as, bs) = unzip2 (map2 (\xs y -> (y, i32.sum (map (+y) xs))) xss ys) 5 | in (i32.sum as, bs) 6 | -------------------------------------------------------------------------------- /tests/issue596.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Consuming.*"xs" 3 | 4 | def consume (xs: *[]i32) = xs 5 | 6 | def main (xss: [][]i32) = map (\xs -> consume xs) xss 7 | -------------------------------------------------------------------------------- /tests/issue605.fut: -------------------------------------------------------------------------------- 1 | def main (xs: *[][]i32) = 2 | let xs_1 = copy xs[1] 3 | let xs[0] = xs_1 4 | in xs 5 | -------------------------------------------------------------------------------- /tests/issue608.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { empty([0][3]i32) } output { empty([0][3]i32) } 3 | -- compiled input { [[1,2]] } error: 4 | 5 | def main (xs: [][3]i32) = xs 6 | -------------------------------------------------------------------------------- /tests/issue643.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { empty([0][0]i32) } 3 | -- output { 0i64 } 4 | 5 | def main [n][m] (xs: [n][m]i32) = m 6 | -------------------------------------------------------------------------------- /tests/issue649.fut: -------------------------------------------------------------------------------- 1 | -- The problem was that invalid size parameters were passed to the 2 | -- 'length' function after internalisation. 3 | 4 | def main = loop xs = [0] while length xs == 0 do xs 5 | -------------------------------------------------------------------------------- /tests/issue661.fut: -------------------------------------------------------------------------------- 1 | def f (b: f32): (i32, []f32) = 2 | (0, [b]) 3 | 4 | def main (i: i32) = 5 | (\i -> f (f32.i32 i)) i 6 | -------------------------------------------------------------------------------- /tests/issue672.fut: -------------------------------------------------------------------------------- 1 | def main (xs: *[]i32) = 2 | let x = xs[0] 3 | let xs[0] = xs[1] 4 | let xs[0] = x 5 | in xs 6 | -------------------------------------------------------------------------------- /tests/issue679.fut: -------------------------------------------------------------------------------- 1 | def main (xs: [](i32,i32)) = 2 | let y = xs[0] with 1 = 0 3 | in y 4 | -------------------------------------------------------------------------------- /tests/issue680.fut: -------------------------------------------------------------------------------- 1 | def main (xs: *[]i32) = 2 | (xs with [1] = xs[0]) with [1] = xs[1] 3 | -------------------------------------------------------------------------------- /tests/issue681.fut: -------------------------------------------------------------------------------- 1 | type dir = #up | #down 2 | 3 | def move (x: i32) (d: dir) = 4 | match d 5 | case #down -> x+1 6 | case #up -> x-1 7 | 8 | def main x = (move x #up, move x #down) 9 | -------------------------------------------------------------------------------- /tests/issue682.fut: -------------------------------------------------------------------------------- 1 | def main (i: i32) = 2 | let xs = [0] 3 | let a = xs[0] 4 | let xs[i] = a 5 | let xs[i] = xs[0] 6 | in xs 7 | -------------------------------------------------------------------------------- /tests/issue706.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { [true, false] } 3 | -- output { [1f32, f32.nan] } 4 | 5 | def main = map (\x -> if x then 1 else f32.nan) 6 | -------------------------------------------------------------------------------- /tests/issue712.fut: -------------------------------------------------------------------------------- 1 | def main (x: i32) (y: i32) = 2 | let t = (x,y) 3 | let f g = g t.0 4 | in f (+2) 5 | -------------------------------------------------------------------------------- /tests/issue767.fut: -------------------------------------------------------------------------------- 1 | def main (is: []i32) (xss: [][]i32) = 2 | map (\i -> map (\xs -> loop z = i for _p < 10 do i32.sum (map (+z) xs)) xss) is 3 | -------------------------------------------------------------------------------- /tests/issue780.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { 2 3 } output { 6 } 3 | 4 | def main (x: i32) (y: i32) = ((*) x) y 5 | -------------------------------------------------------------------------------- /tests/issue798.fut: -------------------------------------------------------------------------------- 1 | -- Variables should not be in scope in their own type. 2 | 3 | module m = { 4 | type t = i32 5 | } 6 | 7 | def main (m: m.t) = m 8 | -------------------------------------------------------------------------------- /tests/issue814.fut: -------------------------------------------------------------------------------- 1 | def main (n: i64) = map ((-) n) (iota n) 2 | -------------------------------------------------------------------------------- /tests/issue815.fut: -------------------------------------------------------------------------------- 1 | def main : (i32) = 2 | loop _ = 0 for i < 1 do i 3 | -------------------------------------------------------------------------------- /tests/issue825.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- entry: a 3 | -- random input { 0u8 } auto output 4 | 5 | entry a (i: u8) = 0 6 | -------------------------------------------------------------------------------- /tests/issue829.fut: -------------------------------------------------------------------------------- 1 | def main (xs: *[1][1]i32) (ys: [1]i32) : *[1][1]i32 = 2 | xs with [0] = ys 3 | -------------------------------------------------------------------------------- /tests/issue847.fut: -------------------------------------------------------------------------------- 1 | -- Tiling bug. 2 | 3 | def main (acc: []i64) (c: i64) (n:i64) = 4 | let is = map (+c) (iota n) 5 | let fs = map (\i -> reduce (+) 0 (map (+(i+c)) acc)) (iota n) 6 | in (fs, is) 7 | -------------------------------------------------------------------------------- /tests/issue872.fut: -------------------------------------------------------------------------------- 1 | type t = #foo | #bar 2 | 3 | def main (x:i32) = 4 | match #foo : t 5 | case #foo -> 6 | let xs = filter (>x) [1,2,3] 7 | in length xs 8 | case #bar -> 9 | 0 10 | -------------------------------------------------------------------------------- /tests/issue873.fut: -------------------------------------------------------------------------------- 1 | type^ myType = #myVal (i32 -> i32) 2 | 3 | def main = 4 | match ((\m -> #myVal (\_ -> m)) 0 : myType) 5 | case #myVal m -> m 1 6 | -------------------------------------------------------------------------------- /tests/issue895.fut: -------------------------------------------------------------------------------- 1 | entry a = 2 | let scan' op ne as = scan op ne as 3 | in scan' (+) 0 [] 4 | 5 | entry b = a 6 | -------------------------------------------------------------------------------- /tests/issue931.fut: -------------------------------------------------------------------------------- 1 | type~ g2 = #g2 ([]i32) | #nog 2 | 3 | def foo2 (x: g2): g2 = 4 | match x 5 | case #nog -> #g2 [] 6 | case _ -> x 7 | -------------------------------------------------------------------------------- /tests/issue992.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { [1,2,3] } output { [1,2,3] } 3 | 4 | def main [n] (xs: [n]i32) = reverse (reverse xs) 5 | -------------------------------------------------------------------------------- /tests/localfunction0.fut: -------------------------------------------------------------------------------- 1 | -- A simple locally defined function. 2 | -- == 3 | -- input { [1,2,3] } output { [3,4,5] } 4 | 5 | def main [n] (a: [n]i32) = 6 | let add_two (x: i32) = x + 2 7 | in map add_two a 8 | -------------------------------------------------------------------------------- /tests/localfunction11.fut: -------------------------------------------------------------------------------- 1 | -- Local functions should not affect aliasing. 2 | 3 | def main (ops: []i32) (exs: []i32) = 4 | let correct op ex = op == ex 5 | in ops |> filter (\op -> all (correct op) exs) 6 | -------------------------------------------------------------------------------- /tests/localfunction12.fut: -------------------------------------------------------------------------------- 1 | -- Local function used in operator section. 2 | 3 | def main (x: i32) (y: i32) (z: i32) = 4 | let add x y = x + y + z 5 | in x `add` y 6 | -------------------------------------------------------------------------------- /tests/localfunction6.fut: -------------------------------------------------------------------------------- 1 | def main(n: i32) = 2 | let f (i: i32) = (loop (i) while i < n do i+1) 3 | in f 2 4 | -------------------------------------------------------------------------------- /tests/loops/for-in0.fut: -------------------------------------------------------------------------------- 1 | -- Basic for-in loop. 2 | -- == 3 | -- input { [1,2,3,4,5] } 4 | -- output { 15 } 5 | 6 | def main(xs: []i32) = 7 | loop a=0 for x in xs do a + x 8 | -------------------------------------------------------------------------------- /tests/loops/for-in4.fut: -------------------------------------------------------------------------------- 1 | -- For-in over 2D array. 2 | -- == 3 | -- input { [[1],[2],[3]] } 4 | -- output { 6 } 5 | 6 | def main (xss: [][]i32) = 7 | loop a = 0 for xs in xss do a + xs[0] 8 | -------------------------------------------------------------------------------- /tests/loops/loop9.fut: -------------------------------------------------------------------------------- 1 | -- Test that we can remove a single-iteration loop. 2 | -- == 3 | -- structure { Loop 0 } 4 | 5 | def main(x: i32, y: i32): i32 = 6 | loop (x) for i < 1 do x + y 7 | -------------------------------------------------------------------------------- /tests/loops/while-loop3.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { 1 } output { 11 false } 3 | 4 | def main (x: i32) = 5 | loop (x, continue) = (x, true) while continue do 6 | (x+1, x < 10) 7 | -------------------------------------------------------------------------------- /tests/man/test/example3.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- random input { [100]i32 [100]i32 } auto output 3 | -- random input { [1000]i32 [1000]i32 } auto output 4 | 5 | def main xs ys = i32.product (map2 (*) xs ys) 6 | -------------------------------------------------------------------------------- /tests/mapiota.fut: -------------------------------------------------------------------------------- 1 | -- iota cannot be mapped. 2 | -- == 3 | -- error: type containing anonymous sizes 4 | 5 | def main(ns: []i64) = map iota ns 6 | -------------------------------------------------------------------------------- /tests/mapreplicate.fut: -------------------------------------------------------------------------------- 1 | -- replicate can be mapped. 2 | -- == 3 | -- input { 2i64 [true,false] } output { [[true,true],[false,false]] } 4 | 5 | def main (n: i64) (xs: []bool) = map (replicate n) xs 6 | -------------------------------------------------------------------------------- /tests/memory-block-merging/coalescing/issue-1930.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { 5000i64 [1i64] } 3 | -- error: 4 | 5 | def main [n] (k: i64) (dst: *[n]i64) = 6 | let src = iota k 7 | in dst with [1:4] = src 8 | -------------------------------------------------------------------------------- /tests/memory-block-merging/coalescing/map/map13.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- random input { [2000]i32 } 3 | -- auto output 4 | -- structure gpu-mem { Alloc 1 } 5 | 6 | def main (xs: *[]i32) = take 1000 (map (+1) xs) 7 | -------------------------------------------------------------------------------- /tests/modules/ascription-error7.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: constructive 3 | 4 | module m : { 5 | type sum [n][m] 6 | } = { 7 | type sum [n][m] = [n+m]bool 8 | } 9 | -------------------------------------------------------------------------------- /tests/modules/ascription14.fut: -------------------------------------------------------------------------------- 1 | -- Uniqueness stuff. 2 | -- == 3 | 4 | module M : { 5 | val f : *[1]f32 -> bool 6 | } = { 7 | def f (_: [1]f32) = true 8 | } 9 | 10 | def main (_: []f32) = M.f 11 | -------------------------------------------------------------------------------- /tests/modules/ascription15.fut: -------------------------------------------------------------------------------- 1 | module type mt = { 2 | type sum [n][m] = ([n]bool, [m]bool, [n+m]bool) 3 | } 4 | 5 | module m : mt = { 6 | type sum [n][m] = ([n]bool, [m]bool, [n+m]bool) 7 | } 8 | -------------------------------------------------------------------------------- /tests/modules/ascription7.fut: -------------------------------------------------------------------------------- 1 | -- Basic/naive use of ascription. 2 | -- == 3 | -- input {} output { 2 } 4 | 5 | module m = { def x = 2 } 6 | module m': { val x: i32 } = m 7 | 8 | def main = m'.x 9 | -------------------------------------------------------------------------------- /tests/modules/entry.fut: -------------------------------------------------------------------------------- 1 | -- OK to use module type in an entry point (although perhaps not 2 | -- useful). 3 | 4 | module M = { 5 | type t = bool 6 | } : { type t } 7 | 8 | entry main (x: (M.t,M.t)) : (M.t,M.t) = x 9 | -------------------------------------------------------------------------------- /tests/modules/hof0.fut: -------------------------------------------------------------------------------- 1 | -- OK because the module defines a higher-order type and the module 2 | -- type specifies a lifted type. 3 | 4 | module m = { type^ t = i32 -> i32 } : { type ^t } 5 | -------------------------------------------------------------------------------- /tests/modules/hof2.fut: -------------------------------------------------------------------------------- 1 | -- OK; perfect match. 2 | 3 | module m = { type t 'a = a } : { type t 'a } 4 | -------------------------------------------------------------------------------- /tests/modules/hof4.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: non-lifted 3 | 4 | module m = { type^ t '^a = a } : { type t 'a } 5 | -------------------------------------------------------------------------------- /tests/modules/hof6.fut: -------------------------------------------------------------------------------- 1 | -- Higher-order abstract types may not be array elements! 2 | -- == 3 | -- error: Cannot create array 4 | 5 | module m = { type^ t = i32 -> i32 } : { type ^t } 6 | 7 | def x: []m.t = [] 8 | -------------------------------------------------------------------------------- /tests/modules/hof8.fut: -------------------------------------------------------------------------------- 1 | -- Lifted abstract types from a module parameter cannot be array 2 | -- elements! 3 | -- == 4 | -- error: might contain function 5 | 6 | module m = \(p: {type ^a}) -> { def v: []p.a = [] } 7 | -------------------------------------------------------------------------------- /tests/modules/import-qualified.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { 1 } 3 | -- output { 3 } 4 | 5 | module M = import "importee-qualified" 6 | 7 | def main(a: i32): i32 = M.whatever 1 8 | -------------------------------------------------------------------------------- /tests/modules/importee-qualified.fut: -------------------------------------------------------------------------------- 1 | def whatever(x: i32) = x + 2 2 | -------------------------------------------------------------------------------- /tests/modules/index_qual_array.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { 4 } output { 5 } 3 | 4 | module M = { 5 | def a: []i32 = [1,2,3] 6 | } 7 | 8 | def main(x: i32): i32 = M.a[0] + x 9 | -------------------------------------------------------------------------------- /tests/modules/liftedness0.fut: -------------------------------------------------------------------------------- 1 | -- Abstract type must be at most as lifted as in the module type. 2 | -- == 3 | -- error: vector 4 | 5 | module type mt = { type~ vector } 6 | 7 | module m = { type^ vector = []i32 } : mt 8 | -------------------------------------------------------------------------------- /tests/modules/liftedness2.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Non-lifted type abbreviations may not contain functions. 3 | 4 | module type mt = {type t '^a} 5 | module m : mt = {type t '^a = a} 6 | -------------------------------------------------------------------------------- /tests/modules/local_open0.fut: -------------------------------------------------------------------------------- 1 | -- Does local open work at all? 2 | -- == 3 | -- input { 1 } output { 6 } 4 | 5 | module m = { 6 | def x = 2 7 | def y = 3 8 | } 9 | 10 | def main(x: i32) = x + m.(x + y) 11 | -------------------------------------------------------------------------------- /tests/modules/open0.fut: -------------------------------------------------------------------------------- 1 | -- Does the open declaration work at all? 2 | -- == 3 | -- input { } output { 4 } 4 | 5 | module M = { 6 | def the_value = 4 7 | } 8 | 9 | open M 10 | 11 | def main = the_value 12 | -------------------------------------------------------------------------------- /tests/modules/shadowing4.fut: -------------------------------------------------------------------------------- 1 | -- Shadowing of types should work as expected. 2 | -- == 3 | -- input { } output { 2 } 4 | 5 | type t = i32 6 | 7 | module m = { 8 | type t = t 9 | } 10 | 11 | def main: t = 2 12 | -------------------------------------------------------------------------------- /tests/modules/sig-error0.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: non-anonymous 3 | 4 | module type mt = { 5 | val f: []i32 -> i32 6 | } 7 | -------------------------------------------------------------------------------- /tests/modules/sig-error1.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: quux 3 | 4 | module type mt = { 5 | val f: (quux: i32) -> (quux: i32) -> i32 6 | } 7 | -------------------------------------------------------------------------------- /tests/modules/sig1.fut: -------------------------------------------------------------------------------- 1 | -- Signature with abstract type. 2 | 3 | module type MONOID = { 4 | type t 5 | 6 | val neutral: t 7 | val op: t -> t -> t 8 | } 9 | 10 | def main(): i32 = 0 11 | -------------------------------------------------------------------------------- /tests/modules/sizeparams-error2.fut: -------------------------------------------------------------------------------- 1 | -- Size parameters may not be duplicated. 2 | -- == 3 | -- error: n 4 | 5 | module type mt = { 6 | type matrix [n] [n] 7 | } 8 | -------------------------------------------------------------------------------- /tests/modules/sizeparams5.fut: -------------------------------------------------------------------------------- 1 | module m : { 2 | type~ t '~a 3 | val mk '~a : () -> t a 4 | } = { 5 | type~ t '~a = () 6 | def mk () = () 7 | } 8 | 9 | def f '~a (b: bool) : m.t a = m.mk () 10 | -------------------------------------------------------------------------------- /tests/modules/sizeparams8.fut: -------------------------------------------------------------------------------- 1 | module meta: { 2 | val plus_comm [a][b]'t : [a+b]t -> [b+a]t 3 | } = { 4 | def plus_comm [a][b]'t (xs: [a+b]t): [b+a]t = xs :> [b+a]t 5 | } 6 | -------------------------------------------------------------------------------- /tests/modules/sizes1.fut: -------------------------------------------------------------------------------- 1 | module type withvec_mt = { 2 | val n : i64 3 | val xs : [n]i64 4 | } 5 | 6 | module withvec : withvec_mt = { 7 | def n = 3i64 8 | def xs = iota n 9 | } 10 | -------------------------------------------------------------------------------- /tests/modules/sizes5.fut: -------------------------------------------------------------------------------- 1 | local module type sparse = { 2 | type~ mat = ?[nnz].[nnz]i64 3 | } 4 | 5 | module sparse : sparse = { 6 | type~ mat = ?[nnz].[nnz]i64 7 | } 8 | -------------------------------------------------------------------------------- /tests/modules/sizes6.fut: -------------------------------------------------------------------------------- 1 | local module type sparse = { 2 | type^ mat = (nnz: i64) -> [nnz]i64 3 | } 4 | 5 | module sparse : sparse = { 6 | type^ mat = (nnz: i64) -> [nnz]i64 7 | } 8 | -------------------------------------------------------------------------------- /tests/modules/tst1.fut: -------------------------------------------------------------------------------- 1 | module type T1 = { type t type s = t val a : s val f : s -> i32 } 2 | module X : T1 = { type t = i32 type s = i32 def a : s = 3 def f (x:s) : i32 = x } -- ok 3 | def main () : i32 = X.f X.a 4 | -------------------------------------------------------------------------------- /tests/modules/typeparams-error0.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: vector 3 | 4 | module type MT = { 5 | type vector 'a 6 | } 7 | 8 | module M: MT = { type vector = []i32 } 9 | -------------------------------------------------------------------------------- /tests/modules/typeparams-error2.fut: -------------------------------------------------------------------------------- 1 | -- Type parameters may not be duplicated. 2 | -- == 3 | -- error: previously 4 | 5 | module type mt = { 6 | type whatevs 't 't 7 | } 8 | -------------------------------------------------------------------------------- /tests/modules/with5.fut: -------------------------------------------------------------------------------- 1 | -- Refinement of a parametric may expand it. 2 | -- == 3 | 4 | module type has_t = { type t 'a } 5 | module type has_t' = has_t with t '^a = a 6 | -------------------------------------------------------------------------------- /tests/mul0.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { f64.nan } output { f64.nan } 3 | 4 | entry main (x: f64) = 0 * x 5 | -------------------------------------------------------------------------------- /tests/nestedmain.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { true } output { false } 3 | 4 | module m = { 5 | def main (x: i32) = x + 2 6 | } 7 | 8 | def main b : bool = !b 9 | -------------------------------------------------------------------------------- /tests/noinline/noinline0.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { [1,2,3] } output { [3,4,5] } 3 | -- structure gpu { SegMap/Apply 1 } 4 | 5 | def f (x: i32) = x + 2 6 | 7 | def main = map (\x -> #[noinline] f x) 8 | -------------------------------------------------------------------------------- /tests/noinline/noinline1.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { 3 [1,2,3] } output { [4,5,6] } 3 | -- structure gpu { SegMap/Apply 1 } 4 | 5 | def f (x: i32) (y: i32) = x + y 6 | 7 | def main y = map (\x -> #[noinline] f x y) 8 | -------------------------------------------------------------------------------- /tests/opaque.fut: -------------------------------------------------------------------------------- 1 | -- Test that 'opaque' prevents constant-folding. 2 | -- == 3 | -- input {} output {4} 4 | -- structure { BinOp 1 Opaque 1 } 5 | 6 | def main = opaque 2 + 2 7 | -------------------------------------------------------------------------------- /tests/operator/section1.fut: -------------------------------------------------------------------------------- 1 | -- Operator section as argument to map2 library function. 2 | -- == 3 | -- input { [4,2,1] [5,6,3] } output { [9,8,4] } 4 | 5 | def main (xs: []i32) (ys: []i32) = map2 (+) xs ys 6 | -------------------------------------------------------------------------------- /tests/operator/section5.fut: -------------------------------------------------------------------------------- 1 | -- Test that parameter names are not lost in sections. 2 | 3 | def main n (x: i32) = (`replicate` x) n 4 | -------------------------------------------------------------------------------- /tests/operator/section6.fut: -------------------------------------------------------------------------------- 1 | -- Test that parameter names are not lost in sections. 2 | 3 | def flipreplicate x n = replicate n x 4 | 5 | def main n (x: i32) = (x `flipreplicate`) n 6 | -------------------------------------------------------------------------------- /tests/operator/size-section0.fut: -------------------------------------------------------------------------------- 1 | -- Check that sizes are well calculated in left section 2 | 3 | def main [n][m][l] (xs : [n]i64) (ys: [m]i64) (mat: [l][m]i64) = 4 | [xs ++ ys] ++ map (xs ++) mat 5 | -------------------------------------------------------------------------------- /tests/operator/size-section1.fut: -------------------------------------------------------------------------------- 1 | -- Check that sizes are well calculated in right section 2 | 3 | def main [n][m][l] (xs : [n]i64) (ys: [m]i64) (mat: [l][n]i64) = 4 | [xs ++ ys] ++ map (++ ys) mat 5 | -------------------------------------------------------------------------------- /tests/operator/userdef-error0.fut: -------------------------------------------------------------------------------- 1 | -- You can't override &&. 2 | -- == 3 | -- error: && 4 | 5 | def (x: bool) && (y: bool) = x 6 | 7 | def main(x: bool) = x && x 8 | -------------------------------------------------------------------------------- /tests/operator/userdef-error1.fut: -------------------------------------------------------------------------------- 1 | -- You can't override ||. 2 | -- == 3 | -- error: \|\| 4 | 5 | def (x: bool) || (y: bool) = x 6 | 7 | def main(x: bool) = x || x 8 | -------------------------------------------------------------------------------- /tests/operator/userdef0.fut: -------------------------------------------------------------------------------- 1 | -- Can we define a user-defined operator at all? 2 | -- == 3 | -- input { 2 3 } output { -1 } 4 | 5 | def (x: i32) + (y: i32) = x - y 6 | 7 | def main (x: i32) (y: i32) = x + y 8 | -------------------------------------------------------------------------------- /tests/overflowing/edgecases.fut: -------------------------------------------------------------------------------- 1 | -- Some edge cases of literals that don't overflow, but are close 2 | -- 3 | -- == 4 | 5 | entry main : (i8, i8, u16, f64) = (-128, 127, 65535, 1.79e308) 6 | -------------------------------------------------------------------------------- /tests/overflowing/f32high.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: (out of bounds.*) 3 | 4 | def main : f32 = 9.7e42 5 | -------------------------------------------------------------------------------- /tests/overflowing/f32low.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: (out of bounds.*) 3 | 4 | def main : f32 = -1e40 5 | -------------------------------------------------------------------------------- /tests/overflowing/f64low.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: (out of bounds.*) 3 | 4 | def main : f64 = 1.8e308 5 | -------------------------------------------------------------------------------- /tests/overflowing/i16low.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: (out of bounds.*) 3 | 4 | def main : i16 = -10000000 5 | -------------------------------------------------------------------------------- /tests/overflowing/i32high.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: (out of bounds.*) 3 | 4 | def main : i32 = 1000000000000 5 | -------------------------------------------------------------------------------- /tests/overflowing/i8high.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: (out of bounds.*) 3 | 4 | def main : i8 = 128 5 | -------------------------------------------------------------------------------- /tests/overflowing/i8low.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: (out of bounds.*) 3 | 4 | def main : i8 = -129 5 | -------------------------------------------------------------------------------- /tests/overflowing/u16high.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: (out of bounds.*) 3 | 4 | def main : u16 = 100000 5 | -------------------------------------------------------------------------------- /tests/overflowing/u32low.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: (out of bounds.*) 3 | 4 | def main : u32 = -4 5 | -------------------------------------------------------------------------------- /tests/overflowing/u8high.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: (out of bounds.*) 3 | 4 | def main : u8 = 256 5 | -------------------------------------------------------------------------------- /tests/overflowing/u8low.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: (out of bounds.*) 3 | 4 | def main : u8 = -4 5 | -------------------------------------------------------------------------------- /tests/paths/subdir/has_abs.fut: -------------------------------------------------------------------------------- 1 | open import "../has_abs" 2 | -------------------------------------------------------------------------------- /tests/powneg.fut: -------------------------------------------------------------------------------- 1 | -- Do not crash during constant folding if encountering a negative 2 | -- exponent. 3 | -- == 4 | -- input { true } error: 5 | 6 | def main b = if b then 2 ** -1 else 0 7 | -------------------------------------------------------------------------------- /tests/prefix_error.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: cannot be used as infix 3 | 4 | def x ! y = x + y 5 | -------------------------------------------------------------------------------- /tests/prefix_prec.fut: -------------------------------------------------------------------------------- 1 | -- Test that prefix operators have the right precedence. 2 | -- 3 | -- == 4 | -- input {1 2} output { 1 } 5 | 6 | def main x y = -x%y : i32 7 | -------------------------------------------------------------------------------- /tests/primitive/acos32.fut: -------------------------------------------------------------------------------- 1 | -- Does the acos32 function work? 2 | -- == 3 | -- input { [1f32, 0.5403023f32, -1f32] } 4 | -- output { [0f32, 1f32, 3.1415927f32] } 5 | 6 | def main = map f32.acos 7 | -------------------------------------------------------------------------------- /tests/primitive/acos64.fut: -------------------------------------------------------------------------------- 1 | -- Does the acos64 function work? 2 | -- == 3 | -- input { [1f64, 0.5403023f64, -1f64] } 4 | -- output { [0f64, 1f64, 3.1415927f64] } 5 | 6 | def main = map f64.acos 7 | -------------------------------------------------------------------------------- /tests/primitive/acosh16.fut: -------------------------------------------------------------------------------- 1 | -- Does the f16.acosh function work? 2 | -- == 3 | -- input { [1f16, 0.5403023f16, 3.14f16] } 4 | -- output { [0f16, f16.nan, 1.810991348900196f16 ] } 5 | 6 | def main = map f16.acosh 7 | -------------------------------------------------------------------------------- /tests/primitive/acosh32.fut: -------------------------------------------------------------------------------- 1 | -- Does the f32.acosh function work? 2 | -- == 3 | -- input { [1f32, 0.5403023f32, 3.14f32] } 4 | -- output { [0f32, f32.nan, 1.810991348900196f32 ] } 5 | 6 | def main = map f32.acosh 7 | -------------------------------------------------------------------------------- /tests/primitive/acosh64.fut: -------------------------------------------------------------------------------- 1 | -- Does the f64.acosh function work? 2 | -- == 3 | -- input { [1f64, 0.5403023f64, 3.14f64] } 4 | -- output { [0f64, f64.nan, 1.810991348900196f64 ] } 5 | 6 | def main = map f64.acosh 7 | -------------------------------------------------------------------------------- /tests/primitive/atan32.fut: -------------------------------------------------------------------------------- 1 | -- Does the atan32 function work? 2 | -- == 3 | -- input { [0f32, 1f32, -1f32] } 4 | -- output { [0f32, 0.78539819f32, -0.78539819f32] } 5 | 6 | def main = map f32.atan 7 | -------------------------------------------------------------------------------- /tests/primitive/atan64.fut: -------------------------------------------------------------------------------- 1 | -- Does the atan32 function work? 2 | -- == 3 | -- input { [0f64, 1f64, -1f64] } 4 | -- output { [0f64, 0.78539819f64, -0.78539819f64] } 5 | 6 | def main = map f64.atan 7 | -------------------------------------------------------------------------------- /tests/primitive/cos32.fut: -------------------------------------------------------------------------------- 1 | -- Does the cos32 function work? 2 | -- == 3 | -- input { [0f32, -1f32, 3.1415927f32, -3.1415927f32] } 4 | -- output { [1f32, 0.5403023f32, -1f32, -1f32] } 5 | 6 | def main = map f32.cos 7 | -------------------------------------------------------------------------------- /tests/primitive/cos64.fut: -------------------------------------------------------------------------------- 1 | -- Does the cos64 function work? 2 | -- == 3 | -- input { [0.0, -1.0, 3.1415927, -3.1415927] } 4 | -- output { [1.0, 0.5403023, -1.0, -1.0] } 5 | 6 | def main = map f64.cos 7 | -------------------------------------------------------------------------------- /tests/primitive/tan32.fut: -------------------------------------------------------------------------------- 1 | -- Does the tan32 function work? 2 | -- == 3 | -- input { [0f32, 0.78539819f32, -0.78539819f32] } 4 | -- output { [0f32, 1f32, -1f32] } 5 | 6 | def main = map f32.tan 7 | -------------------------------------------------------------------------------- /tests/primitive/tan64.fut: -------------------------------------------------------------------------------- 1 | -- Does the tan64 function work? 2 | -- == 3 | -- input { [0f64, 0.78539819f64, -0.78539819f64] } 4 | -- output { [0f64, 1f64, -1f64] } 5 | 6 | def main = map f64.tan 7 | -------------------------------------------------------------------------------- /tests/proj-error0.fut: -------------------------------------------------------------------------------- 1 | -- 2 | -- == 3 | -- error: field 4 | 5 | def main(x: (i32,i8,i16)): (i8,i16,i32) = 6 | (x.0, x.2, x.0) 7 | -------------------------------------------------------------------------------- /tests/proj-error1.fut: -------------------------------------------------------------------------------- 1 | -- Ambiguous projection. 2 | -- == 3 | -- error: ambiguous 4 | 5 | def f = (.a) 6 | -------------------------------------------------------------------------------- /tests/proj1.fut: -------------------------------------------------------------------------------- 1 | -- Can we map a tuple projection? 2 | -- == 3 | -- input { [1,2] [3,4] } 4 | -- output { [1,2] } 5 | 6 | def main (xs: []i32) (ys: []i32): []i32 = 7 | map (.0) (zip xs ys) 8 | -------------------------------------------------------------------------------- /tests/proj2.fut: -------------------------------------------------------------------------------- 1 | -- Can we map a record projection? 2 | -- == 3 | -- input { [1,2] [3,4] } 4 | -- output { [1,2] } 5 | 6 | def main (xs: []i32) (ys: []i32): []i32 = 7 | map (.x) (map2 (\x y -> {x, y}) xs ys) 8 | -------------------------------------------------------------------------------- /tests/random_test_float.fut: -------------------------------------------------------------------------------- 1 | -- Testing random float constants. 2 | -- == 3 | -- random input { [1]f32 f32 1.5f32 } 4 | 5 | def main arr x y : f32 = arr[0] + x + y 6 | -------------------------------------------------------------------------------- /tests/record-update0.fut: -------------------------------------------------------------------------------- 1 | -- Basic record update. 2 | -- == 3 | -- input { 0 0 } output { 2 0 } 4 | 5 | def main (x: i32) (y: i32): (i32, i32) = 6 | let r0 = {x, y} 7 | let r1 = r0 with x = 2 8 | in (r1.x, r1.y) 9 | -------------------------------------------------------------------------------- /tests/record-update1.fut: -------------------------------------------------------------------------------- 1 | -- Type-changing record update. 2 | -- == 3 | -- error: i32.*bool 4 | 5 | def main (x: i32) (y: i32): (bool, i32) = 6 | let r0 = {x, y} 7 | let r1 = r0 with x = true 8 | in (r1.x, r1.y) 9 | -------------------------------------------------------------------------------- /tests/records-error0.fut: -------------------------------------------------------------------------------- 1 | -- Duplicate fields in a record type is an error. 2 | -- == 3 | -- error: Duplicate 4 | 5 | type t = {x: i32, x: i32} 6 | -------------------------------------------------------------------------------- /tests/records-error2.fut: -------------------------------------------------------------------------------- 1 | -- Error if we try to access a non-existent field. 2 | -- == 3 | -- error: field.*c 4 | 5 | def main() = 6 | let r = {a=1,b=2} 7 | in r.c 8 | -------------------------------------------------------------------------------- /tests/records-error3.fut: -------------------------------------------------------------------------------- 1 | -- A record value must have at least the fields of its corresponding 2 | -- type. 3 | -- == 4 | -- error: match 5 | 6 | def main() = 7 | let r:{a:i32,b:i32} = {a=0} 8 | in 0 9 | -------------------------------------------------------------------------------- /tests/records-error4.fut: -------------------------------------------------------------------------------- 1 | -- A record value must not have more fields than its corresponding 2 | -- type. 3 | -- == 4 | -- error: match 5 | 6 | def main() = 7 | let r:{a:i32} = {a=0,b=0} 8 | in 0 9 | -------------------------------------------------------------------------------- /tests/records-error5.fut: -------------------------------------------------------------------------------- 1 | -- It is not OK to define the same field twice. 2 | -- == 3 | -- error: previously defined 4 | 5 | def main(x: i32) = 6 | let r = {a=x, b=x+1, a=x+2} 7 | in (r.a, r.b) 8 | -------------------------------------------------------------------------------- /tests/records-error6.fut: -------------------------------------------------------------------------------- 1 | -- It is not OK to match the same field twice. 2 | -- == 3 | -- error: Duplicate fields 4 | 5 | def main(x: i32) = 6 | let {x=a, x=b} = {x} 7 | in a+b 8 | -------------------------------------------------------------------------------- /tests/records-error7.fut: -------------------------------------------------------------------------------- 1 | -- Specific error message on record field mismatches. 2 | -- == 3 | -- error: Unshared fields: d, c. 4 | 5 | def f (v: {a: i32, b: i32, c: i32}) : {a: i32, b: i32, d: i32} = v 6 | -------------------------------------------------------------------------------- /tests/records0.fut: -------------------------------------------------------------------------------- 1 | -- Do records work at all? 2 | -- == 3 | -- input { 2 } output { 1 3 } 4 | 5 | def f(x: i32) = {y=x+1,x=x-1} 6 | 7 | def main(x: i32) = 8 | let r = f x 9 | in (r.x, r.y) 10 | -------------------------------------------------------------------------------- /tests/records1.fut: -------------------------------------------------------------------------------- 1 | -- Tuples can be used like records. 2 | -- == 3 | -- input { 2 } output { 3 1 } 4 | 5 | def f(x: i32) = (x+1,x-1) 6 | 7 | def main(x: i32) = 8 | let r = f x 9 | in (r.0, r.1) 10 | -------------------------------------------------------------------------------- /tests/records10.fut: -------------------------------------------------------------------------------- 1 | def main (a: [4]u64) (b: [4]u64) (c: [4]u64) = 2 | (\p -> let x = length(p.0) 3 | let y = length(p.1.0) 4 | let z = length(p.1.1) 5 | in x < y && y < z) 6 | (a,(b,c)) 7 | -------------------------------------------------------------------------------- /tests/records11.fut: -------------------------------------------------------------------------------- 1 | -- We can index the result of a projection. 2 | -- == 3 | -- input { [1,2,3] 4 } 4 | -- output { 2 } 5 | 6 | def main (x: []i32) (y: i32) = 7 | let t = (x,y) 8 | in t.0[1] 9 | -------------------------------------------------------------------------------- /tests/records2.fut: -------------------------------------------------------------------------------- 1 | -- Records can be used like tuples. 2 | -- == 3 | -- input { 2 } output { 3 1 } 4 | 5 | def f(x: i32) = {0=x+1,1=x-1} 6 | 7 | def main(x: i32) = f x 8 | -------------------------------------------------------------------------------- /tests/records3.fut: -------------------------------------------------------------------------------- 1 | -- Test tuple patterns. 2 | -- == 3 | -- input { 2 } output { 3 1 } 4 | 5 | def f(x: i32) = {a=x+1,b=x-1} 6 | 7 | def main(x: i32) = 8 | let {a, b=c} = f x 9 | in (a,c) 10 | -------------------------------------------------------------------------------- /tests/records5.fut: -------------------------------------------------------------------------------- 1 | -- Implicit field expressions. 2 | -- == 3 | -- input { 1 2 } output { 1 2 } 4 | 5 | def main (x: i32) (y: i32) = 6 | let r = {y,x} 7 | in (r.x, r.y) 8 | -------------------------------------------------------------------------------- /tests/records8.fut: -------------------------------------------------------------------------------- 1 | -- Record field access can be nested. 2 | -- == 3 | -- input { 2 } output { 3 } 4 | 5 | def main(x: i32) = 6 | let r = {a=x,b=x+1,c={b=x,a={a={b=x+1}}}} 7 | in r.c.a.a.b 8 | -------------------------------------------------------------------------------- /tests/records9.fut: -------------------------------------------------------------------------------- 1 | -- Access a record field inside a module. 2 | -- == 3 | -- input { 1 } output { 3 } 4 | 5 | module m = { def r = { x = 2 } } 6 | 7 | def main (x: i32) = m.r.x + x 8 | -------------------------------------------------------------------------------- /tests/reg-tiling/batch-mm-lud.fut.tuning: -------------------------------------------------------------------------------- 1 | main.suff_outer_par_0=4194304 2 | -------------------------------------------------------------------------------- /tests/reg-tiling/reg3d-test1.fut.tuning: -------------------------------------------------------------------------------- 1 | main.suff_outer_par_0=200 2 | -------------------------------------------------------------------------------- /tests/reg-tiling/reg3d-test2.fut.tuning: -------------------------------------------------------------------------------- 1 | main.suff_outer_par_0=200 2 | -------------------------------------------------------------------------------- /tests/reg-tiling/reg3d-test3.fut.tuning: -------------------------------------------------------------------------------- 1 | main.suff_outer_par_0=100 2 | -------------------------------------------------------------------------------- /tests/reg-tiling/sgemm.fut.tuning: -------------------------------------------------------------------------------- 1 | main1.suff_outer_par_0=1048576 2 | main2.suff_outer_par_0=1048576 3 | main3.suff_outer_par_0=1048576 4 | -------------------------------------------------------------------------------- /tests/reshape3.fut: -------------------------------------------------------------------------------- 1 | -- Reshape with a polymorphic type, where only the outer dimensions 2 | -- are reshaped. 3 | 4 | def main [n][m][k] (A: [n][m][k]f32): []i32 = 5 | let A' = flatten A 6 | in map (\_ -> 0) A' 7 | -------------------------------------------------------------------------------- /tests/returntype-error2.fut: -------------------------------------------------------------------------------- 1 | -- Test basic detection of wrong function return types. 2 | -- == 3 | -- error: 4 | 5 | def main(): i32 = 2.0 6 | -------------------------------------------------------------------------------- /tests/reverse1.fut: -------------------------------------------------------------------------------- 1 | -- Reverse an inner array using indexing. 2 | -- 3 | -- == 4 | -- input { [[1,2],[3,4]] } output { [[2,1],[4,3]] } 5 | 6 | def main(as: [][]i32): [][]i32 = as[:,::-1] 7 | -------------------------------------------------------------------------------- /tests/rosettacode/greatest_element_of_list.fut: -------------------------------------------------------------------------------- 1 | def main (xs: []f64) = reduce f64.max (-f64.inf) xs 2 | -------------------------------------------------------------------------------- /tests/safety/div0.fut: -------------------------------------------------------------------------------- 1 | -- Division by zero, and in a parallel context at that! 2 | -- == 3 | -- input { [0] } error: 4 | 5 | def main (xs: []i32) = map (2/) xs 6 | -------------------------------------------------------------------------------- /tests/safety/map0.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- random input { [20000]f32 } error: Index \[-1\] 3 | 4 | def main [n] (xs: [n]f32) = 5 | map (\i -> xs[if i == 1000 then -1 else i]) (iota n) 6 | -------------------------------------------------------------------------------- /tests/safety/powneg.fut: -------------------------------------------------------------------------------- 1 | -- Negative integer exponent, and in a parallel context at that! 2 | -- == 3 | -- input { 2 [-1] } error: 4 | 5 | def main (b: i32) (xs: []i32) = map (b**) xs 6 | -------------------------------------------------------------------------------- /tests/safety/reduce0.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- random input { [20000]f32 } error: Index \[-1\] 3 | 4 | def main [n] (xs: [n]f32) = 5 | f32.sum (map (\i -> xs[if i == 1000 then -1 else i]) (iota n)) 6 | -------------------------------------------------------------------------------- /tests/safety/scan0.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- random input { [20000]f32 } error: Index \[-1\] 3 | 4 | def main [n] (xs: [n]f32) = 5 | scan (+) 0 (map (\i -> xs[if i == 1000 then -1 else i]) (iota n)) 6 | -------------------------------------------------------------------------------- /tests/safety/scatter0.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- random input { [20000]f32 } error: Index \[-1\] 3 | 4 | def main [n] (xs: [n]f32) = 5 | spread 5 3 (iota n) (map (\i -> xs[if i == 1000 then -1 else i]) (iota n)) 6 | -------------------------------------------------------------------------------- /tests/scatter/data/tiny.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diku-dk/futhark/e4c272556d6dd5c0832b3e522c3e408cfb748141/tests/scatter/data/tiny.out -------------------------------------------------------------------------------- /tests/scatter/fusion/scatter-scatter-not-possible.fut: -------------------------------------------------------------------------------- 1 | def main (xs: *[]i32) (ys: *[]i32) = 2 | let xs' = scatter xs [0] [1] 3 | in (xs', scatter ys [0] xs') 4 | -------------------------------------------------------------------------------- /tests/scatter/singleton.fut: -------------------------------------------------------------------------------- 1 | -- #1793 2 | -- == 3 | -- input { [false] 0i64 } output { [true] } 4 | -- input { [false] 1i64 } output { [false] } 5 | 6 | def main (xs: *[1]bool) i = 7 | scatter xs [i] [true] 8 | -------------------------------------------------------------------------------- /tests/scatter/write-error0.fut: -------------------------------------------------------------------------------- 1 | -- Fail if the argument to write is not unique. 2 | -- 3 | -- == 4 | -- error: Consuming 5 | 6 | def main(a: []i32): []i32 = 7 | scatter a [0] [1] 8 | -------------------------------------------------------------------------------- /tests/scatter/write5.fut: -------------------------------------------------------------------------------- 1 | 2 | def main [n] ((a: [n]f32, ja: []i32)): ([]f32, []i32) = 3 | let res = zip a ja 4 | let idxs = iota n 5 | in unzip (scatter (copy res) idxs res) 6 | -------------------------------------------------------------------------------- /tests/script/data/input.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diku-dk/futhark/e4c272556d6dd5c0832b3e522c3e408cfb748141/tests/script/data/input.in -------------------------------------------------------------------------------- /tests/script/script2.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- script input { 1i32 } output { 3i32 } 3 | 4 | def main (x: i32) = x + 2 5 | -------------------------------------------------------------------------------- /tests/script/script3.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- entry: dotprod 3 | -- script input @ script3.futharkscript 4 | 5 | entry dotprod (xs: []f64) (ys: []f64) = f64.sum (map2 (*) xs ys) 6 | -------------------------------------------------------------------------------- /tests/script/script3.futharkscript: -------------------------------------------------------------------------------- 1 | let A = [1.0,2.0,3.0] 2 | in (A, A) 3 | -------------------------------------------------------------------------------- /tests/script/script4.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- entry: doeswork 3 | -- script input { let x = 2 in let y = 3 in mkdata x y } output { 10 } 4 | 5 | entry mkdata x y = x + y : i32 6 | 7 | entry doeswork z = z * 2 8 | -------------------------------------------------------------------------------- /tests/script/script6.fut: -------------------------------------------------------------------------------- 1 | -- Can we read our own source code? 2 | -- == 3 | -- script input { $loadbytes "script6.fut" } 4 | -- output { 139i64 } 5 | 6 | def main (s: []u8) = length s 7 | -------------------------------------------------------------------------------- /tests/shapes/argdims1.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { 2i64 } 3 | -- output { [0i64] [-1] } 4 | 5 | def main (n: i64) = 6 | let foo = iota (n-1) 7 | let bar = replicate (n-1) (-1) 8 | in (foo, bar) 9 | -------------------------------------------------------------------------------- /tests/shapes/ascript-existential.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { 0i64 } output { 1i64 } 3 | -- input { 1i64 } output { 2i64 } 4 | 5 | def main (n: i64) = 6 | length (iota (n+1): []i64) 7 | -------------------------------------------------------------------------------- /tests/shapes/assert0.fut: -------------------------------------------------------------------------------- 1 | def main n : [n]i64 = iota (assert (n>10) n) 2 | -------------------------------------------------------------------------------- /tests/shapes/attr0.fut: -------------------------------------------------------------------------------- 1 | def main n : [n]i64 = iota (#[unsafe] n) 2 | -------------------------------------------------------------------------------- /tests/shapes/coerce1.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { [[1,2],[4,5],[7,8]] } 3 | -- output { [[1i32, 4i32, 7i32], [2i32, 5i32, 8i32]] } 4 | 5 | def main [n] [m] (xss: [n][m]i32) = 6 | transpose xss :> [2][3]i32 7 | -------------------------------------------------------------------------------- /tests/shapes/emptydim3.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { 2i64 } output { 2i64 empty([0][2]i32) } 3 | 4 | def empty 'a (x: i64) = (x, [] : [0]a) 5 | 6 | def main x : (i64, [][x]i32) = empty x 7 | -------------------------------------------------------------------------------- /tests/shapes/entry-constants-sum.fut: -------------------------------------------------------------------------------- 1 | type t = #foo ([5]i32) | #bar ([5]i32) 2 | 3 | def main (x: t) (y: i32) = 0 4 | -------------------------------------------------------------------------------- /tests/shapes/error0.fut: -------------------------------------------------------------------------------- 1 | -- Actually check against the function return type, too. 2 | -- == 3 | -- error: 10 4 | 5 | def main (xs: []i32) (ys: []i32) : [10]i32 = xs ++ ys 6 | -------------------------------------------------------------------------------- /tests/shapes/error1.fut: -------------------------------------------------------------------------------- 1 | -- Cannot magically change sizes. 2 | -- == 3 | -- error: \[10\]i32 4 | 5 | def main [n] (xs: [n]i32) : [10]i32 = xs 6 | -------------------------------------------------------------------------------- /tests/shapes/error10.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Causality check 3 | 4 | def main (b: bool) (xs: []i32) = 5 | let a = [] : [][]i32 6 | let b = [filter (>0) xs] 7 | in a[0] == b[0] 8 | -------------------------------------------------------------------------------- /tests/shapes/error13.fut: -------------------------------------------------------------------------------- 1 | -- No hiding a size inside a function! 2 | -- == 3 | -- error: anonymous 4 | 5 | type^ t = []bool -> bool 6 | -------------------------------------------------------------------------------- /tests/shapes/error14.fut: -------------------------------------------------------------------------------- 1 | -- Inspired by #2271. No constructing impossible types just by making them 2 | -- phantoms! 3 | -- == 4 | -- error: "x" 5 | 6 | def f (x: i64, _: bool) : [0][x]i32 = [] 7 | -------------------------------------------------------------------------------- /tests/shapes/error2.fut: -------------------------------------------------------------------------------- 1 | -- An implied/unknown size can still only be inferred to have one concrete size. 2 | -- == 3 | -- error: (\[1\]i32, \[2\]i32) 4 | 5 | def main (xs: []i32) : ([1]i32, [2]i32) = (xs, xs) 6 | -------------------------------------------------------------------------------- /tests/shapes/error6.fut: -------------------------------------------------------------------------------- 1 | -- Respect sizes based on named parameters. 2 | -- == 3 | -- error: "n" 4 | 5 | def ap (f: (n: i64) -> [n]i32) (k: i64) : [k]i32 = 6 | f k 7 | 8 | def main = ap (\n -> iota (n+1)) 10 9 | -------------------------------------------------------------------------------- /tests/shapes/error8.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Entry point 3 | 4 | def empty 'a (x: i32) = (x, [] : [0]a) 5 | 6 | def main x : (i32, [][]i32) = empty x 7 | -------------------------------------------------------------------------------- /tests/shapes/explicit-shapes-error1.fut: -------------------------------------------------------------------------------- 1 | -- An explicitly quantified size must be used where it is bound. 2 | -- == 3 | -- error: n 4 | 5 | def main [n] (x: i32) = n 6 | -------------------------------------------------------------------------------- /tests/shapes/explicit-shapes0.fut: -------------------------------------------------------------------------------- 1 | -- Explicit shape quantification. 2 | -- = 3 | -- input { [1,2,3] } output { 3 } 4 | 5 | def main [n] (x: [n]i32) = n 6 | -------------------------------------------------------------------------------- /tests/shapes/extlet0.fut: -------------------------------------------------------------------------------- 1 | -- A type becomes existential because a name goes out of scope. 2 | -- == 3 | -- input { 1i64 } output { 1i64 } 4 | 5 | def main n = 6 | length (let m = n in iota m) 7 | -------------------------------------------------------------------------------- /tests/shapes/extlet1.fut: -------------------------------------------------------------------------------- 1 | -- A type becomes existential because a name goes out of scope, 2 | -- trickier. 3 | -- == 4 | -- input { 1i64 } output { 2i64 } 5 | 6 | def main n = 7 | length (let m = n+1 in iota m) 8 | -------------------------------------------------------------------------------- /tests/shapes/field-in-size.fut: -------------------------------------------------------------------------------- 1 | -- Allow to access argument field as size for return type 2 | -- == 3 | 4 | def f (p: {a:i64,b:bool}) : [p.a]i64 = iota p.a 5 | -------------------------------------------------------------------------------- /tests/shapes/funshape1.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Causality check 3 | 4 | def f [n] (_: [n]i32 -> i32) : [n]i32 -> i64 = 5 | let m = n + 1 6 | in \_ -> m 7 | 8 | def main xs = f (\_ -> 0) <| filter (>0) xs 9 | -------------------------------------------------------------------------------- /tests/shapes/funshape2.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: scope violation 3 | 4 | def main xs = (\f' -> f' (filter (>0) xs)) (\_ -> 0) 5 | -------------------------------------------------------------------------------- /tests/shapes/funshape3.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { 5i64 } output { 7i64 } 3 | 4 | def f [n] (_: [n]i64) (_: [n]i64 -> i32, _: [n]i64) = 5 | n 6 | 7 | def main x = f (iota (x+2)) (\_ -> 0, iota (x+2)) 8 | -------------------------------------------------------------------------------- /tests/shapes/funshape5.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Entry point functions may not be polymorphic 3 | 4 | def main indices (cs: *[](i32,i32)) j = 5 | map (\k -> (indices[j],k)) <| drop (j+1) indices 6 | -------------------------------------------------------------------------------- /tests/shapes/funshape6.fut: -------------------------------------------------------------------------------- 1 | -- Based on issue 1351. 2 | -- == 3 | -- input { [[1.0,2.0,3.0],[4.0,5.0,6.0]] 0i64 4i64 } 4 | 5 | def main (xs: [][]f64) i j = (.[i:j]) <| iota (i+j) 6 | -------------------------------------------------------------------------------- /tests/shapes/funshape7.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Causality check 3 | 4 | entry main xs mat = map (filter (>0) xs ++) mat 5 | -------------------------------------------------------------------------------- /tests/shapes/if1.fut: -------------------------------------------------------------------------------- 1 | def main [n][m] (world: [n][m]i32): [n][m]i32 = 2 | map2 (\(c: [m]i32) i -> if i == n-1 then world[n-1] else c) world (iota n) 3 | -------------------------------------------------------------------------------- /tests/shapes/if3.fut: -------------------------------------------------------------------------------- 1 | -- Size-variant branches don't have just any size. 2 | -- == 3 | -- error: \[n\].*\[m\] 4 | 5 | def main (b: bool) (n: i64) (m: i64) : [2]i64 = 6 | if b then iota n else iota m 7 | -------------------------------------------------------------------------------- /tests/shapes/irregular0.fut: -------------------------------------------------------------------------------- 1 | -- Irregularity must be detected! 2 | -- == 3 | -- input {0} error: 4 | 5 | def main (x: i32) = ([([1], [2,3]), ([2,3], [1]) :> ([1]i32, [2]i32)])[1] 6 | -------------------------------------------------------------------------------- /tests/shapes/letshape0.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { [1,2,-3] } output { 2i64 } 3 | 4 | def main (xs: []i32) = 5 | let [n] (xs': [n]i32) = filter (>0) xs 6 | in n 7 | -------------------------------------------------------------------------------- /tests/shapes/letshape1.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Size \[n\] unused 3 | 4 | def main (xs: []i32) = 5 | let [n] xs' = filter (>0) xs 6 | in n 7 | -------------------------------------------------------------------------------- /tests/shapes/letshape11.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { [1,2,-3] } output { [1,2] } 3 | 4 | def main (xs: []i32) = 5 | let [n] (xs': [n]i32) = filter (>0) xs 6 | in xs' 7 | -------------------------------------------------------------------------------- /tests/shapes/letshape12.fut: -------------------------------------------------------------------------------- 1 | -- #2210 2 | -- == 3 | -- error: Unknown name "n" 4 | 5 | def f : [42]f32 = 6 | let [n] turtle: f32 -> [n]f32 = \(x: f32) -> replicate n x 7 | in turtle 42 8 | -------------------------------------------------------------------------------- /tests/shapes/letshape2.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: "n" and "m" do not match 3 | 4 | def main n m = 5 | let [k] (xss: [k][k]i64) = replicate n (iota m) 6 | in k 7 | -------------------------------------------------------------------------------- /tests/shapes/letshape3.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { } output { 0i64 } 3 | 4 | def main = 5 | let [k] (xss: [k][k]i64) = [] 6 | in k 7 | -------------------------------------------------------------------------------- /tests/shapes/letshape4.fut: -------------------------------------------------------------------------------- 1 | -- The monomorphiser forgot to keep around the 'n' in this program at 2 | -- one point. 3 | 4 | def n = 1i64 5 | def vec 't arr = arr : [n]t 6 | def main (xs: []i32) = vec xs 7 | -------------------------------------------------------------------------------- /tests/shapes/letshape5.fut: -------------------------------------------------------------------------------- 1 | -- A size goes out of scope. 2 | -- == 3 | -- input { 2i64 } 4 | -- output { [0i64,1i64,2i64] } 5 | 6 | def main (n: i64) : [n+1]i64 = 7 | let m = n + 1 8 | in iota m 9 | -------------------------------------------------------------------------------- /tests/shapes/letshape7.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Ambiguous size "m". 3 | 4 | def main = 5 | let [n][m] (xss: [n][m]i64) = [] 6 | in (n, m) 7 | -------------------------------------------------------------------------------- /tests/shapes/letshape8.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Cannot bind \[n\] 3 | 4 | def main = 5 | let [n] (f: [n]bool -> [n]bool) = (\(xs: [10]bool) -> xs) 6 | in n 7 | -------------------------------------------------------------------------------- /tests/shapes/loop1.fut: -------------------------------------------------------------------------------- 1 | -- Loops impose sizes. 2 | -- == 3 | -- error: \[10\]i32 4 | 5 | def main [n] (xs: *[n]i32) : [10]i32 = 6 | loop xs for i < n do xs with [i] = xs[i] + 1 7 | -------------------------------------------------------------------------------- /tests/shapes/loop10.fut: -------------------------------------------------------------------------------- 1 | -- This crashed lambda lifting at one point. 2 | 3 | def main n = 4 | (\n -> let res = loop xs = replicate n true for i < 10 do xs ++ xs in res) n 5 | -------------------------------------------------------------------------------- /tests/shapes/loop13.fut: -------------------------------------------------------------------------------- 1 | -- Nonsense, but ought to type-check. 2 | def main (xs : [10]i64) = 3 | loop xs for i < 10 do 4 | let n = 10 + i 5 | in (xs :> [n]i64) ++ [i] 6 | -------------------------------------------------------------------------------- /tests/shapes/loop14.fut: -------------------------------------------------------------------------------- 1 | def main (n: i64) = 2 | loop (xs: []i64) = iota n for i < n do (xs ++ xs) 3 | -------------------------------------------------------------------------------- /tests/shapes/loop8.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Causality 3 | 4 | def main : []i32 = 5 | (.0) <| loop (xs: []i32, j) = ([], 0) for i < 10 do (xs ++ xs, j+1) 6 | -------------------------------------------------------------------------------- /tests/shapes/loop9.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Causality 3 | 4 | def main : []i32 = 5 | ([1]++) <| loop (xs: []i32) = [] for i < 10 do (xs ++ xs) 6 | -------------------------------------------------------------------------------- /tests/shapes/match2.fut: -------------------------------------------------------------------------------- 1 | -- Size hidden by match. 2 | -- == 3 | -- input { 2i64 } output { 2i64 } 4 | 5 | def main (n: i64) = 6 | let arr = match n 7 | case m -> iota m 8 | in length arr 9 | -------------------------------------------------------------------------------- /tests/shapes/modules2.fut: -------------------------------------------------------------------------------- 1 | module type mt = { 2 | type^ t [n] = [n]i32 -> i32 3 | } 4 | 5 | module m : mt = { 6 | type^ t [n] = [n]i32 -> i32 7 | } 8 | -------------------------------------------------------------------------------- /tests/shapes/negative-position-shape3.fut: -------------------------------------------------------------------------------- 1 | -- Entry points may not be return-polymorphic. 2 | -- == 3 | -- error: Entry point 4 | 5 | entry main [n] (x: i32) : [n]i32 = replicate n x 6 | -------------------------------------------------------------------------------- /tests/shapes/negative-position-shape4.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { 2i64 } output { [2i64, 2i64] } 3 | 4 | def f [n] (x: i64) : [n]i64 = replicate n x 5 | 6 | def main (x: i64) : [x]i64 = f x 7 | -------------------------------------------------------------------------------- /tests/shapes/paramsize1.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: "k" 3 | 4 | type^ f = (k: i64) -> [k]i32 -> i64 5 | 6 | def f : f = \_ xs -> length xs 7 | 8 | def main [K] (input: [K]i32) = 9 | f K input 10 | -------------------------------------------------------------------------------- /tests/shapes/partial-apply.fut: -------------------------------------------------------------------------------- 1 | -- Size for something that is partially applied. 2 | 3 | def f [n] (x: [n]f32): [n]f32 = x 4 | 5 | def main : []f32 -> []f32 = f 6 | -------------------------------------------------------------------------------- /tests/shapes/polymorphic2.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { 2 } output { 2 empty([0][1]i32) } 3 | 4 | def empty (d: i64) (x: i32) : (i32, [0][d]i32) = (x, []) 5 | 6 | def main (x: i32): (i32, [][1]i32) = empty 1 x 7 | -------------------------------------------------------------------------------- /tests/shapes/polymorphic3.fut: -------------------------------------------------------------------------------- 1 | -- We must be able to infer size-preserving function types. 2 | 3 | def set i v arr = 4 | copy arr with [i] = v 5 | 6 | def main [n] (xs: [n]i32) : [n]i32 = 7 | set 0 0 xs 8 | -------------------------------------------------------------------------------- /tests/shapes/polymorphic4.fut: -------------------------------------------------------------------------------- 1 | -- No hiding sizes behind type inference. 2 | -- == 3 | -- error: do not match 4 | 5 | def foo f x : [1]i32 = 6 | let r = if true then f x : []i32 else [1i32] 7 | in r 8 | -------------------------------------------------------------------------------- /tests/shapes/range0.fut: -------------------------------------------------------------------------------- 1 | -- Some ranges have known sizes. 2 | 3 | def main (n: i64) : ([n]i64, [n]i64, [n]i64, [n + 1 - 1]i64) = 4 | (0.. [m]i64 6 | -------------------------------------------------------------------------------- /tests/shapes/shape-inside-tuple.fut: -------------------------------------------------------------------------------- 1 | -- Issue #125 test program. 2 | -- 3 | -- == 4 | -- input { [[1,2],[3,4],[5,6]] } output { 3i64 } 5 | 6 | def main [n][m] (arg: [n][m]i32) = 7 | n 8 | -------------------------------------------------------------------------------- /tests/shapes/size-inference0.fut: -------------------------------------------------------------------------------- 1 | -- Inference of return size. 2 | 3 | def get_at xs indices = map (\(i: i64) -> xs[i]) indices 4 | 5 | def main [l] (xs: [l]i32): [l]i32 = 6 | get_at xs (iota l) 7 | -------------------------------------------------------------------------------- /tests/shapes/size-inference2.fut: -------------------------------------------------------------------------------- 1 | -- Sometimes we should infer that a size cannot be typed. 2 | -- == 3 | -- error: Sizes.*do not match 4 | 5 | def main [n] (xs: [n]i32) : [n]i32 = iota (length xs) 6 | -------------------------------------------------------------------------------- /tests/shapes/size-inference5.fut: -------------------------------------------------------------------------------- 1 | -- Like size-inference4.fut, but with a let-binding. 2 | -- == 3 | -- error: scope violation 4 | 5 | def f xs n = zip xs (iota n) 6 | -------------------------------------------------------------------------------- /tests/shapes/slice1.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: do not match 3 | 4 | def main [n] [m] (xs: [n]i32) (ys: [m]i32) = 5 | zip xs[1:] ys[1:] 6 | -------------------------------------------------------------------------------- /tests/shapes/toplevel0.fut: -------------------------------------------------------------------------------- 1 | -- Important that size is existential. 2 | def values = [1] ++ [2] 3 | 4 | def main = copy values 5 | -------------------------------------------------------------------------------- /tests/sinking0.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- structure gpu { /Index 1 } 3 | 4 | def main (arr: [](i32, i32, i32, i32, i32)) = 5 | let (a,b,c,d,e) = arr[0] 6 | in if a == 0 then 0 else b + c + d + e 7 | -------------------------------------------------------------------------------- /tests/size-expr-for-in.fut: -------------------------------------------------------------------------------- 1 | -- ForIn pattern must transform its size expressions 2 | -- == 3 | def main (n:i64) = 4 | loop x = 0 for t in replicate n (iota (n+1)) do 5 | x + reduce (+) 0 t 6 | -------------------------------------------------------------------------------- /tests/slice3.fut: -------------------------------------------------------------------------------- 1 | -- Slicing produces a size that we can obtain. 2 | -- == 3 | -- input { [1,2,3] 0i64 1i64 } output { 1i64 } 4 | 5 | def main (xs: []i32) (i: i64) (j: i64) = 6 | length xs[i:j] 7 | -------------------------------------------------------------------------------- /tests/slice4.fut: -------------------------------------------------------------------------------- 1 | -- Zero strides are detected. 2 | -- == 3 | -- input { [1,2,3,4,5] 0i64 1i64 0i64 } 4 | -- error: out of bounds 5 | 6 | def main (xs: []i32) a b c = 7 | xs[a:b:c] 8 | -------------------------------------------------------------------------------- /tests/soacs/filter4.fut: -------------------------------------------------------------------------------- 1 | -- The array produced by filter should be unique. 2 | 3 | def main (xs: *[]i32) = 4 | let xs' = filter (\x -> x>0) xs 5 | let xs[0] = 0 6 | in xs' 7 | -------------------------------------------------------------------------------- /tests/soacs/map10.fut: -------------------------------------------------------------------------------- 1 | -- Test that a simple consuming map produces an error. 2 | -- == 3 | -- error: 4 | 5 | def main(a: *[][]f64): [][]f64 = 6 | map (\(r: *[]f64): *[]f64 -> 7 | r) a 8 | -------------------------------------------------------------------------------- /tests/soacs/map18.fut: -------------------------------------------------------------------------------- 1 | -- Single-iteration maps should be simplified away. 2 | -- 3 | -- == 4 | -- input { 2 } output { [4] } 5 | -- structure { Map 0 } 6 | 7 | def main(x: i32): [1]i32 = 8 | map (+x) (replicate 1 x) 9 | -------------------------------------------------------------------------------- /tests/soacs/map2.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { 3 | -- [1,2,3,4,5,6,7,8] 4 | -- } 5 | -- output { 6 | -- [3, 4, 5, 6, 7, 8, 9, 10] 7 | -- } 8 | def main(a: []i32): []i32 = map (+2) a 9 | -------------------------------------------------------------------------------- /tests/soacs/reduce1.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { 3 | -- [1,2,3,4,5,6,7,8,9] 4 | -- } 5 | -- output { 6 | -- 362880 7 | -- } 8 | def main(a: []i32): i32 = reduce (*) 1 a 9 | -------------------------------------------------------------------------------- /tests/soacs/reduce8.fut: -------------------------------------------------------------------------------- 1 | -- #1800 2 | -- == 3 | -- input { 100i64 } auto output 4 | -- compiled input { 100000i64 } auto output 5 | 6 | def main n = i64.sum (map (\i -> loop i = i+1 while i < 1000 do i * 3) (iota n)) 7 | -------------------------------------------------------------------------------- /tests/sumtypes/coerce2.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Ambiguous.*size coercion 3 | 4 | type opt 't = #some t | #none 5 | 6 | def f b (x: i64) = 7 | if b 8 | then #some (iota x) 9 | else #none :> opt ([2]i64) 10 | -------------------------------------------------------------------------------- /tests/sumtypes/sumtype11.fut: -------------------------------------------------------------------------------- 1 | -- Fail if lacking a type annotation. 2 | -- == 3 | -- error: Type is ambiguous 4 | 5 | def main : i32 = 6 | match (#bar 12) 7 | case (#foo _) -> 1 8 | case (#bar _) -> 2 9 | -------------------------------------------------------------------------------- /tests/sumtypes/sumtype22.fut: -------------------------------------------------------------------------------- 1 | -- Sumtype aliasing. 2 | -- == 3 | 4 | type sum = #foo ([3]i32) | #bar ([2]i32) 5 | 6 | def main (xs: *[3]i32) = 7 | let v : sum = #foo xs 8 | let xs[0] = 0 9 | in xs 10 | -------------------------------------------------------------------------------- /tests/sumtypes/sumtype25.fut: -------------------------------------------------------------------------------- 1 | -- Issue 785 2 | 3 | type mbpd = #Just {pos:i32} 4 | 5 | def main (pd: mbpd) = 6 | match pd 7 | case #Just x -> x.pos 8 | -------------------------------------------------------------------------------- /tests/sumtypes/sumtype26.fut: -------------------------------------------------------------------------------- 1 | -- Issue 785 2 | 3 | type mbpd = #Just {pos:i32} 4 | 5 | def main (pd: mbpd) = 6 | match pd 7 | case #Just {pos} -> pos 8 | -------------------------------------------------------------------------------- /tests/sumtypes/sumtype28.fut: -------------------------------------------------------------------------------- 1 | -- Arrays literals of sum types. 2 | -- == 3 | -- error: bool 4 | 5 | type t = #c i32 6 | 7 | def main = 8 | let ts = [#c 1, #c false] : []t 9 | in 0i32 10 | -------------------------------------------------------------------------------- /tests/sumtypes/sumtype31.fut: -------------------------------------------------------------------------------- 1 | -- Ordering is not defined for sum types. 2 | -- == 3 | -- error: sum type 4 | 5 | def main (x: f32) (y: f32) = 6 | #foo x > #foo y 7 | -------------------------------------------------------------------------------- /tests/sumtypes/sumtype32.fut: -------------------------------------------------------------------------------- 1 | -- Specific error message on constructor mismatches. 2 | -- == 3 | -- error: Unshared constructors: #d, #c. 4 | 5 | def f (v: #a i32 | #b i32 | #c i32) : #a i32 | #b i32 | #d i32 = v 6 | -------------------------------------------------------------------------------- /tests/sumtypes/sumtype34.fut: -------------------------------------------------------------------------------- 1 | type sometype 't = #someval t 2 | def main : sometype (*[]i32) = #someval [1] 3 | -------------------------------------------------------------------------------- /tests/sumtypes/sumtype35.fut: -------------------------------------------------------------------------------- 1 | type t = #foo ([2]i32) 2 | | #bar ([2]i32) ([2]i32) 3 | 4 | def main (x: t) (y: i32) = 2 5 | -------------------------------------------------------------------------------- /tests/sumtypes/sumtype36.fut: -------------------------------------------------------------------------------- 1 | type t = #foo ([2]i32) 2 | | #bar ([2]i32) ([2]i32) 3 | 4 | def main (x: t) = x 5 | -------------------------------------------------------------------------------- /tests/sumtypes/sumtype37.fut: -------------------------------------------------------------------------------- 1 | type t [n] = #foo ([n]i32) 2 | | #bar ([n]i32) ([n]i32) 3 | 4 | def main [n] (x: t [n]) = x 5 | -------------------------------------------------------------------------------- /tests/sumtypes/sumtype38.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Unmatched 3 | 4 | type r = {f0: bool, f1: bool} 5 | 6 | def f (x: r) = 7 | match x 8 | case {f0=false, f1=false} -> 0 9 | case {f0=true, f1=true} -> 0 10 | -------------------------------------------------------------------------------- /tests/sumtypes/sumtype39.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Unmatched 3 | 4 | def f (x: (bool, bool)) = 5 | match x 6 | case (false, false) -> 0 7 | case (true, true) -> 0 8 | -------------------------------------------------------------------------------- /tests/sumtypes/sumtype4.fut: -------------------------------------------------------------------------------- 1 | -- Constructors with different fields should be different. 2 | -- == 3 | -- error: #foo i16.*#foo i32 4 | 5 | def g (x : #foo i32) : #foo i16 = 6 | match x 7 | case y -> y 8 | -------------------------------------------------------------------------------- /tests/sumtypes/sumtype40.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Unmatched 3 | 4 | def f (x: (i32, i32)) = 5 | match x 6 | case (0, _) -> 0 7 | case (_, 1) -> 0 8 | -------------------------------------------------------------------------------- /tests/sumtypes/sumtype41.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Unmatched 3 | 4 | type tuple = #tuple bool bool 5 | 6 | def f (x: tuple) = 7 | match x 8 | case #tuple false false -> 0 9 | case #tuple true true -> 0 10 | -------------------------------------------------------------------------------- /tests/sumtypes/sumtype42.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { -1i32 } output { true } 3 | -- input { 1i32 } output { false } 4 | 5 | def main (x: i32) = 6 | match x case -1 -> true 7 | case _ -> false 8 | -------------------------------------------------------------------------------- /tests/sumtypes/sumtype43.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { -1f32 } output { true } 3 | -- input { 1f32 } output { false } 4 | 5 | def main (x: f32) = 6 | match x case -1f32 -> true 7 | case _ -> false 8 | -------------------------------------------------------------------------------- /tests/sumtypes/sumtype46.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: cannot match 3 | 4 | type t = #foo f64 5 | 6 | def main (surf: t) = 7 | match surf 8 | case #foo -> true 9 | -------------------------------------------------------------------------------- /tests/sumtypes/sumtype47.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: cannot match 3 | 4 | type t = #foo f64 5 | 6 | def main (surf: t) = 7 | match surf 8 | case #foo x y -> x 9 | -------------------------------------------------------------------------------- /tests/sumtypes/sumtype48.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Unshared constructors 3 | 4 | type t = #foo | #bar 5 | 6 | let f b : t = if b then #foo else #baar 7 | -------------------------------------------------------------------------------- /tests/sumtypes/sumtype8.fut: -------------------------------------------------------------------------------- 1 | -- Constructor order shouldn't matter. 2 | -- == 3 | 4 | type foobar = #foo i32 | #bar i32 5 | type barfoo = #bar i32 | #foo i32 6 | 7 | def main (x : foobar) = (#bar 5) : barfoo 8 | -------------------------------------------------------------------------------- /tests/transpose2.fut: -------------------------------------------------------------------------------- 1 | -- Verify that we can perform an in-place update on the result of a 2 | -- transposition. 3 | -- == 4 | 5 | def main (xss: *[][]i32) = 6 | let xss' = transpose xss 7 | in xss' with [0,1] = 2 8 | -------------------------------------------------------------------------------- /tests/types/README.md: -------------------------------------------------------------------------------- 1 | Type system tests. The programs here should be simple and not do 2 | much. 3 | -------------------------------------------------------------------------------- /tests/types/alias-error0.fut: -------------------------------------------------------------------------------- 1 | -- No circular types! 2 | -- 3 | -- == 4 | -- error: Unknown type 5 | 6 | type t = t 7 | 8 | def main(x: t): t = x 9 | -------------------------------------------------------------------------------- /tests/types/alias-error2.fut: -------------------------------------------------------------------------------- 1 | -- Warn on unique non-arrays 2 | -- 3 | -- == 4 | -- warning: has no effect* 5 | 6 | type t = i32 7 | 8 | def main(x: *t): t = x 9 | -------------------------------------------------------------------------------- /tests/types/alias-error3.fut: -------------------------------------------------------------------------------- 1 | -- You may not define the same alias twice. 2 | -- 3 | -- == 4 | -- error: Duplicate.*mydup 5 | 6 | type mydup = i32 7 | type mydup = f32 8 | 9 | def main(x: i32): i32 = x 10 | -------------------------------------------------------------------------------- /tests/types/alias-error4.fut: -------------------------------------------------------------------------------- 1 | -- No undefined types! 2 | -- 3 | -- == 4 | -- error: Unknown type 5 | 6 | type foo = bar 7 | 8 | def main(x: foo): foo = x 9 | -------------------------------------------------------------------------------- /tests/types/alias-error5.fut: -------------------------------------------------------------------------------- 1 | -- A type abbreviation must use all of its size parameters. 2 | -- == 3 | -- error: Size parameter "\[n\]" 4 | 5 | type matrix [n] = i32 6 | -------------------------------------------------------------------------------- /tests/types/alias0.fut: -------------------------------------------------------------------------------- 1 | type best_type = i32 2 | 3 | def main(x: i32): best_type = x 4 | -------------------------------------------------------------------------------- /tests/types/alias1.fut: -------------------------------------------------------------------------------- 1 | type t = i32 2 | type ts [n] = [n]t 3 | 4 | def main(xs: ts [], x: t): ts [] = 5 | map (+x) xs 6 | -------------------------------------------------------------------------------- /tests/types/alias2.fut: -------------------------------------------------------------------------------- 1 | -- Can we put type aliases in lambdas too? 2 | 3 | type t = i32 4 | type ts [n] = [n]t 5 | 6 | def main(xs: ts []): [](ts []) = 7 | map (\(x: t): [10]t -> replicate 10 x) xs 8 | -------------------------------------------------------------------------------- /tests/types/alias3.fut: -------------------------------------------------------------------------------- 1 | -- Nest array type aliases 2 | 3 | type t = i32 4 | type ts [n] = [n]t 5 | type tss [n][m] = [n](ts [m]) 6 | 7 | def main(xss: tss [][]): tss [][] = xss 8 | -------------------------------------------------------------------------------- /tests/types/alias4.fut: -------------------------------------------------------------------------------- 1 | -- An array type alias can be unique. 2 | 3 | type matrix [n][m] = [n][m]i32 4 | 5 | def main(m: *matrix [][]): matrix [][] = 6 | let m[0,0] = 0 in m 7 | -------------------------------------------------------------------------------- /tests/types/alias5.fut: -------------------------------------------------------------------------------- 1 | -- Uniqueness goes outside-in. 2 | 3 | type uniqlist [n] = *[n]i32 4 | 5 | def main(p: [][]i32): [](uniqlist []) = 6 | p 7 | -------------------------------------------------------------------------------- /tests/types/badsquare.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Sizes.*do not match 3 | 4 | type square [n] 't = [n][n]t 5 | 6 | def ext_square n : square [] i64 = tabulate_2d (n+1) (n+2) (\i j -> i + j) 7 | -------------------------------------------------------------------------------- /tests/types/ext0.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { 0i64 } 3 | -- output { [[true,true],[true,true]] } 4 | 5 | def main x : ?[n].[n][n]bool = 6 | let n = x+2 7 | in replicate n (replicate n true) 8 | -------------------------------------------------------------------------------- /tests/types/ext3.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { [true,false] } 3 | -- output { 2i64 } 4 | 5 | def main (xs: ?[n].[n]bool) : i64 = length xs 6 | -------------------------------------------------------------------------------- /tests/types/ext4.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { [true] [2] } 3 | -- output { 1i64 } 4 | 5 | def main [n] (xs: ?[m].[m]bool) (ys: [n]i32) = length (zip xs ys) 6 | -------------------------------------------------------------------------------- /tests/types/ext7.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: Existential size would appear 3 | 4 | def f (n: i64) (m: i64) (b: [n][m]bool) = b[0,0] 5 | 6 | def g = uncurry f 7 | 8 | def main x y = g x y 9 | -------------------------------------------------------------------------------- /tests/types/function-error0.fut: -------------------------------------------------------------------------------- 1 | -- Polymorphic function called incorrectly. 2 | -- == 3 | -- error: Cannot apply "f" 4 | 5 | def f 't (x: t) (y: t) = (x,y) 6 | 7 | def main () = f 1 false 8 | -------------------------------------------------------------------------------- /tests/types/function-error3.fut: -------------------------------------------------------------------------------- 1 | -- Entry points may not be polymorphic. 2 | -- == 3 | -- error: polymorphic 4 | 5 | def main 't (x: t) = x 6 | -------------------------------------------------------------------------------- /tests/types/function0.fut: -------------------------------------------------------------------------------- 1 | -- Simplest polymorphic function. 2 | -- == 3 | -- input { 1 } output { 1 } 4 | 5 | def id 't (x: t): t = x 6 | 7 | def main(x: i32) = id x 8 | -------------------------------------------------------------------------------- /tests/types/function2.fut: -------------------------------------------------------------------------------- 1 | -- Anonymous array element type. 2 | -- == 3 | -- input { [1,2,3] } output { [3,2,1] } 4 | 5 | def reverse [n] 't (a: [n]t): [n]t = a[::-1] 6 | 7 | def main (x: []i32) = reverse x 8 | -------------------------------------------------------------------------------- /tests/types/function6.fut: -------------------------------------------------------------------------------- 1 | -- A polymorphic function can be used curried. 2 | -- == 3 | -- input { [1,2,3] } output { [1,2,3] } 4 | 5 | def id 't (x: t) = x 6 | 7 | def main(xs: []i32) = map id xs 8 | -------------------------------------------------------------------------------- /tests/types/function7.fut: -------------------------------------------------------------------------------- 1 | -- Array dimensions in function type may refer to previous named parameters. 2 | 3 | def f (g: (n: i64) -> [n]i32) = g 0 4 | -------------------------------------------------------------------------------- /tests/types/inference-error1.fut: -------------------------------------------------------------------------------- 1 | -- No switcharoos. 2 | -- == 3 | -- error: Function body does not have expected type 4 | 5 | def id 'a 'b (x: a) (y: b): (a, b) = (y, x) 6 | -------------------------------------------------------------------------------- /tests/types/inference-error12.fut: -------------------------------------------------------------------------------- 1 | -- A record turns out to be missing a field. 2 | -- == 3 | -- error: expected type 4 | 5 | def f r = let y = r.l2 6 | in (r: {l1: i32}) 7 | -------------------------------------------------------------------------------- /tests/types/inference-error13.fut: -------------------------------------------------------------------------------- 1 | -- A record turns out to have the wrong type of field. 2 | -- == 3 | -- error: 4 | 5 | def f r = let y: f32 = r.l 6 | in (r: {l: i32}) 7 | -------------------------------------------------------------------------------- /tests/types/inference-error14.fut: -------------------------------------------------------------------------------- 1 | -- A record must have an unambiguous type (no row polymorphism). 2 | -- == 3 | -- error: ambiguous 4 | 5 | def f x = x.l 6 | -------------------------------------------------------------------------------- /tests/types/inference-error2.fut: -------------------------------------------------------------------------------- 1 | -- If something is put in an array, it cannot later be inferred as a 2 | -- function. 3 | -- == 4 | -- error: functional 5 | 6 | def f x = ([x], x 2) 7 | -------------------------------------------------------------------------------- /tests/types/inference-error3.fut: -------------------------------------------------------------------------------- 1 | -- If something is applied, it cannot later be put in an array. 2 | -- == 3 | -- error: -> b 4 | 5 | def f x = (x 2, [x]) 6 | -------------------------------------------------------------------------------- /tests/types/inference-error4.fut: -------------------------------------------------------------------------------- 1 | -- If something is used in a loop, it cannot later be inferred as a 2 | -- function. 3 | -- == 4 | -- error: functional 5 | 6 | def f x = (loop x = x for i < 10 do x, x 2) 7 | -------------------------------------------------------------------------------- /tests/types/inference-error5.fut: -------------------------------------------------------------------------------- 1 | -- A type parameter cannot be inferred as a specific type. 2 | -- == 3 | -- error: does not have expected type 4 | 5 | def f 't (x: i32): t = x 6 | -------------------------------------------------------------------------------- /tests/types/inference-error7.fut: -------------------------------------------------------------------------------- 1 | -- Ambiguous equality type. 2 | -- == 3 | -- error: ambiguous 4 | 5 | def add x y = x == y 6 | -------------------------------------------------------------------------------- /tests/types/inference-error8.fut: -------------------------------------------------------------------------------- 1 | -- If something is used for equality, it cannot later be inferred as a 2 | -- function. 3 | -- == 4 | -- error: equality 5 | 6 | def f x = (x == x, x 2) 7 | -------------------------------------------------------------------------------- /tests/types/inference-error9.fut: -------------------------------------------------------------------------------- 1 | -- Equality not defined for type parameters. 2 | -- == 3 | -- error: equality 4 | 5 | def main 't (x: t) = x == x 6 | -------------------------------------------------------------------------------- /tests/types/inference0.fut: -------------------------------------------------------------------------------- 1 | -- The simplest conceivable type inference. 2 | -- == 3 | -- input { 2 } output { 2 } 4 | 5 | def id x = x 6 | 7 | def main (x: i32) = id x 8 | -------------------------------------------------------------------------------- /tests/types/inference1.fut: -------------------------------------------------------------------------------- 1 | -- Inferred-polymorphic function instantiated twice. 2 | -- == 3 | -- input { 2 true } output { true 2 } 4 | 5 | def id x = x 6 | 7 | def main (x: i32) (y: bool): (bool, i32) = (id y, id x) 8 | -------------------------------------------------------------------------------- /tests/types/inference10.fut: -------------------------------------------------------------------------------- 1 | -- Disambiguating with array elements. 2 | -- == 3 | -- input { 0 } output { [0,1] } 4 | 5 | def main x = [x, 1] 6 | -------------------------------------------------------------------------------- /tests/types/inference11.fut: -------------------------------------------------------------------------------- 1 | -- An empty array literal is fine! 2 | 3 | def main: []i32 = [] 4 | -------------------------------------------------------------------------------- /tests/types/inference12.fut: -------------------------------------------------------------------------------- 1 | -- Type inference based on SOAC usage. 2 | -- == 3 | -- input { [true, false] } output { false } 4 | 5 | def main xs = reduce (&&) true xs 6 | -------------------------------------------------------------------------------- /tests/types/inference13.fut: -------------------------------------------------------------------------------- 1 | -- Inference from indexing. 2 | -- == 3 | 4 | def f xsss = xsss[0,1,2] 5 | 6 | def main xsss: i32 = f xsss 7 | -------------------------------------------------------------------------------- /tests/types/inference14.fut: -------------------------------------------------------------------------------- 1 | -- Inference when overloading is involved. 2 | -- == 3 | -- input { 1 } output { 3 } 4 | 5 | def main x = x + 2 6 | -------------------------------------------------------------------------------- /tests/types/inference15.fut: -------------------------------------------------------------------------------- 1 | -- Inference with both overloading and lambdas. 2 | -- == 3 | -- input { 1 } output { 3 } 4 | 5 | def main x = (\y -> x + y) 2 6 | -------------------------------------------------------------------------------- /tests/types/inference16.fut: -------------------------------------------------------------------------------- 1 | -- Equality overloading! 2 | -- == 3 | -- input { 2 } output { true } 4 | 5 | def main x = x == 2 6 | -------------------------------------------------------------------------------- /tests/types/inference17.fut: -------------------------------------------------------------------------------- 1 | -- Both arithmetic and equality overloading at once! 2 | -- == 3 | -- input { 2 3 } output { false } 4 | 5 | def main x y = y == x + 2 6 | -------------------------------------------------------------------------------- /tests/types/inference19.fut: -------------------------------------------------------------------------------- 1 | -- Loop bound inference 2 | 3 | def main x = (loop y = 2 for i < x do y*2, x + 1i8) 4 | -------------------------------------------------------------------------------- /tests/types/inference2.fut: -------------------------------------------------------------------------------- 1 | -- Higher-order inference. 2 | -- == 3 | -- input { 2 } output { 4 } 4 | 5 | def apply f x = f x 6 | 7 | def main x = apply (apply (i32.+) x) x 8 | -------------------------------------------------------------------------------- /tests/types/inference20.fut: -------------------------------------------------------------------------------- 1 | -- For-in loop variable inference. 2 | -- == 3 | -- input { [1,2,3] } output { 9 } 4 | 5 | def main xs = (loop y = 1 for x in xs do y * 2) + xs[0] 6 | -------------------------------------------------------------------------------- /tests/types/inference22.fut: -------------------------------------------------------------------------------- 1 | -- A let-bound function can be instantiated for different types. 2 | -- == 3 | 4 | def main (x: i32) (y: bool) = 5 | let f x y = (y,x) 6 | in (f x y, f y x) 7 | -------------------------------------------------------------------------------- /tests/types/inference24.fut: -------------------------------------------------------------------------------- 1 | -- Use of a variable free in a loop can affect inference. 2 | -- == 3 | -- input { 3 [1,2,3] } output { 3 } 4 | 5 | def main m xs = loop y = 0 for i < m do xs[i] 6 | -------------------------------------------------------------------------------- /tests/types/inference25.fut: -------------------------------------------------------------------------------- 1 | -- Tuple inference via let binding. 2 | 3 | def main x = 4 | let (a,b) = x 5 | in a + 1 + b 6 | -------------------------------------------------------------------------------- /tests/types/inference26.fut: -------------------------------------------------------------------------------- 1 | -- Record inference via let binding. 2 | 3 | def main x = 4 | let {a,b} = x 5 | in a + 1 + b 6 | -------------------------------------------------------------------------------- /tests/types/inference27.fut: -------------------------------------------------------------------------------- 1 | -- Inference of record projection. 2 | -- == 3 | -- input { 2 } output { 2 } 4 | 5 | def f r = let _y = r.l 6 | in (r: {l: i32}) 7 | 8 | def main (l: i32) = (f {l}).l 9 | -------------------------------------------------------------------------------- /tests/types/inference29.fut: -------------------------------------------------------------------------------- 1 | -- Unification of inferred type with ascription in pattern. 2 | -- == 3 | -- input { 2 } output { 2 } 4 | 5 | def main x = let y: i32 = x in y 6 | -------------------------------------------------------------------------------- /tests/types/inference3.fut: -------------------------------------------------------------------------------- 1 | -- An inferred parameter can be put in an array. 2 | -- == 3 | -- input { 2 } output { [2] } 4 | 5 | def f x = [x] 6 | 7 | def main (x: i32) = f x 8 | -------------------------------------------------------------------------------- /tests/types/inference30.fut: -------------------------------------------------------------------------------- 1 | -- Field projection inference for a lambda. 2 | -- == 3 | -- input { 1 } output { [1] } 4 | 5 | def main (x: i32) = map (\r -> r.l) [{l=x}] 6 | -------------------------------------------------------------------------------- /tests/types/inference31.fut: -------------------------------------------------------------------------------- 1 | type^ img 'a = f32 -> a 2 | 3 | def f r: (img bool -> img bool) = 4 | \reg -> let g d x = reg (d+x:f32) 5 | in g r 6 | -------------------------------------------------------------------------------- /tests/types/inference36.fut: -------------------------------------------------------------------------------- 1 | -- Inference through a record/tuple type. 2 | 3 | def f b x (y: (i32, i32)) = 4 | if x.0 == y.0 then (x.0, 0) 5 | else if b then y else x 6 | -------------------------------------------------------------------------------- /tests/types/inference37.fut: -------------------------------------------------------------------------------- 1 | def I_mult (n: i64) (x: i64) (a: i64) : [n][n]i64 = 2 | let elem i j = i64.bool(i == j) * 3 | (if i == x then a else 1) 4 | in tabulate_2d n n elem 5 | -------------------------------------------------------------------------------- /tests/types/inference4.fut: -------------------------------------------------------------------------------- 1 | -- An inferred parameter can be returned from a branch. 2 | -- == 3 | -- input { 2 } output { 2 } 4 | 5 | def f x = if true then x else x 6 | 7 | def main (x: i32) = f x 8 | -------------------------------------------------------------------------------- /tests/types/inference5.fut: -------------------------------------------------------------------------------- 1 | -- Inference for a local function. 2 | -- == 3 | -- input { 2 } output { 4 } 4 | 5 | def main x = 6 | let apply f x = f x 7 | in apply (apply (i32.+) x) x 8 | -------------------------------------------------------------------------------- /tests/types/inference6.fut: -------------------------------------------------------------------------------- 1 | -- Disambiguating with type ascription. 2 | -- == 3 | -- input { 1 } output { 1 } 4 | 5 | def main x = (x: i32) 6 | -------------------------------------------------------------------------------- /tests/types/inference7.fut: -------------------------------------------------------------------------------- 1 | -- Disambiguating with return type. 2 | -- == 3 | -- input { 1 } output { 1 } 4 | 5 | def main x: i32 = x 6 | -------------------------------------------------------------------------------- /tests/types/inference8.fut: -------------------------------------------------------------------------------- 1 | -- Disambiguating with branch type. 2 | -- == 3 | -- input { 1 } output { 1 } 4 | 5 | def main x = if true then x else 0 6 | -------------------------------------------------------------------------------- /tests/types/inference9.fut: -------------------------------------------------------------------------------- 1 | -- Disambiguating with conditional type. 2 | -- == 3 | -- input { true } output { true } 4 | 5 | def main x = if x then true else false 6 | -------------------------------------------------------------------------------- /tests/types/level0.fut: -------------------------------------------------------------------------------- 1 | -- Cannot unify a type parameter with a type bound in an outer scope. 2 | -- == 3 | -- error: "b".*scope 4 | 5 | def f x = 6 | let g 'b (y: b) = if true then y else x 7 | in g 8 | -------------------------------------------------------------------------------- /tests/types/level5.fut: -------------------------------------------------------------------------------- 1 | -- A local binding may not affect the type of an outer parameter. 2 | -- == 3 | -- error: "n".*scope violation 4 | 5 | def main (xs: []i32) = 6 | let n = 2+3 7 | in zip (iota n) xs 8 | -------------------------------------------------------------------------------- /tests/types/lifted-abbrev.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: "arr" 3 | 4 | type^ arr = [2]i32 5 | 6 | type bad = [3]arr -- Bad, because we declared 'arr' to be lifted. 7 | -------------------------------------------------------------------------------- /tests/types/overloaded0.fut: -------------------------------------------------------------------------------- 1 | -- Test of overloaded numeric types. 2 | -- == 3 | -- input { 10f32 } output { 0.01f32 } 4 | 5 | def main (x: f32) = 6 | let y = 0.001 7 | let f (z: f32) = y*z 8 | in f x 9 | -------------------------------------------------------------------------------- /tests/types/overloaded1.fut: -------------------------------------------------------------------------------- 1 | -- Warn when top-level definitions are overloaded. 2 | -- == 3 | -- warning: ambiguous 4 | 5 | def plus x y = x + y 6 | -------------------------------------------------------------------------------- /tests/types/size-lifted-abbrev.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: "arr" 3 | 4 | type~ arr = [2]i32 5 | 6 | type bad = [3]arr -- Bad, because we declared 'arr' to be lifted. 7 | -------------------------------------------------------------------------------- /tests/types/size-lifted0.fut: -------------------------------------------------------------------------------- 1 | -- Size-lifted types can be returned from 'if'. 2 | 3 | def f '~a (b: bool) (x: a) (y: a) = 4 | if b then x else y 5 | -------------------------------------------------------------------------------- /tests/types/sizeparams-error0.fut: -------------------------------------------------------------------------------- 1 | -- Too few arguments. 2 | -- == 3 | -- error: ints 4 | 5 | type ints [n] = [n]i32 6 | 7 | def main(n: i32): ints = iota n 8 | -------------------------------------------------------------------------------- /tests/types/sizeparams-error1.fut: -------------------------------------------------------------------------------- 1 | -- Too many arguments. 2 | -- == 3 | -- error: ints 4 | 5 | type ints [n] = [n]i32 6 | 7 | def main(n: i32): ints [1][2] = iota n 8 | -------------------------------------------------------------------------------- /tests/types/sizeparams-error2.fut: -------------------------------------------------------------------------------- 1 | -- Size parameters may not be duplicated. 2 | -- == 3 | -- error: n 4 | 5 | type matrix [n] [n] = [n][n]i32 6 | -------------------------------------------------------------------------------- /tests/types/sizeparams7.fut: -------------------------------------------------------------------------------- 1 | -- No space is needed before the size argument. 2 | -- == 3 | -- input { 2i64 } output { [0i64,1i64] } 4 | 5 | type ints[n] = [n]i64 6 | 7 | def main (n:i64): ints[n] = iota n 8 | -------------------------------------------------------------------------------- /tests/types/sizeparams8.fut: -------------------------------------------------------------------------------- 1 | -- If a name is used as a size, then it's probably an i32! 2 | -- == 3 | -- input { 3i64 [1,2,3] } output { [1,2,3] } 4 | 5 | def main n (xs: [n]i32) = xs 6 | -------------------------------------------------------------------------------- /tests/types/sizeparams9.fut: -------------------------------------------------------------------------------- 1 | -- From #1573. Make sure we can handle missing whitespace in the parser. 2 | 3 | type a [n] = [n]f32 4 | let f (a:a[]) : a[] = a 5 | -------------------------------------------------------------------------------- /tests/types/typeparams-error0.fut: -------------------------------------------------------------------------------- 1 | -- Missing parameter to a parametric type. 2 | -- == 3 | -- error: vector 4 | 5 | type vector 't = []t 6 | 7 | def main(n: i32): vector = iota n 8 | -------------------------------------------------------------------------------- /tests/types/typeparams-error1.fut: -------------------------------------------------------------------------------- 1 | -- Missing parameter to a multi-parameter parametric tpye. 2 | -- == 3 | -- error: pair 4 | 5 | type pair 'a 'b = (a,b) 6 | 7 | def main (x: i32) (y: f64): pair f64 = (y,x) 8 | -------------------------------------------------------------------------------- /tests/types/typeparams-error2.fut: -------------------------------------------------------------------------------- 1 | -- Type parameters may not be duplicated. 2 | -- == 3 | -- error: previously 4 | 5 | type whatevs 't 't = t 6 | -------------------------------------------------------------------------------- /tests/types/typeparams-error5.fut: -------------------------------------------------------------------------------- 1 | -- Cannot create an array containing elements of a lifted type parameter. 2 | -- == 3 | -- error: Cannot create array 4 | 5 | type t '^a = []a 6 | -------------------------------------------------------------------------------- /tests/types/typeparams0.fut: -------------------------------------------------------------------------------- 1 | -- A simple case of a parametric type. 2 | -- == 3 | -- input { 2i64 } output { [0i64,1i64] } 4 | 5 | type~ vector 't = []t 6 | 7 | def main(n: i64): vector i64 = iota n 8 | -------------------------------------------------------------------------------- /tests/types/typeparams1.fut: -------------------------------------------------------------------------------- 1 | -- Multi-parameter parametric type. 2 | -- == 3 | -- input { 1 2.0 } output { 2.0 1 } 4 | 5 | type pair 'a 'b = (a,b) 6 | 7 | def main (x: i32) (y: f64) = (y,x) : pair f64 i32 8 | -------------------------------------------------------------------------------- /tests/types/typeparams2.fut: -------------------------------------------------------------------------------- 1 | -- Shadowing in type. 2 | -- == 3 | -- input { 2.0 } output { 2.0 } 4 | 5 | type t 'int = int 6 | 7 | def main (x: f64): t f64 = x 8 | -------------------------------------------------------------------------------- /tests/uniqueness/uniqueness-error13.fut: -------------------------------------------------------------------------------- 1 | -- No cheating uniqueness with tuple shenanigans. 2 | -- == 3 | -- error: aliased 4 | 5 | def main (x: (*[]i32, *[]i32)): (*[]i32, *[]i32) = 6 | (x.0, x.0) 7 | -------------------------------------------------------------------------------- /tests/uniqueness/uniqueness-error31.fut: -------------------------------------------------------------------------------- 1 | -- In-place updates with 'with' can also have errors. 2 | -- == 3 | -- error: in-place 4 | 5 | def main [n] (a: *[][n]i32, i: i32): [][]i32 = 6 | a with [i] = a[0] 7 | -------------------------------------------------------------------------------- /tests/uniqueness/uniqueness-error33.fut: -------------------------------------------------------------------------------- 1 | -- Type ascriptions must respect uniqueness. 2 | -- == 3 | -- error: aliased to "x" 4 | 5 | def main (x: []i32) : *[]i32 = x : *[]i32 6 | -------------------------------------------------------------------------------- /tests/uniqueness/uniqueness-error34.fut: -------------------------------------------------------------------------------- 1 | -- Pattern bindings must respect uniqueness. 2 | -- == 3 | -- error: aliased to "x" 4 | 5 | def main (x: []i32) : *[]i32 = let y : *[]i32 = x in y 6 | -------------------------------------------------------------------------------- /tests/uniqueness/uniqueness-error35.fut: -------------------------------------------------------------------------------- 1 | -- Loop parameters must respect uniqueness. 2 | -- == 3 | -- error: Consuming.*"x" 4 | 5 | def main (x: []i32) = loop (x: *[]i32) for i < 10 do x 6 | -------------------------------------------------------------------------------- /tests/uniqueness/uniqueness-error41.fut: -------------------------------------------------------------------------------- 1 | -- Global variables may not be unique! 2 | -- == 3 | -- error: constant 4 | 5 | def global: *[]i32 = [1,2,3] 6 | 7 | def main (x: i32) = 8 | global with [0] = x 9 | -------------------------------------------------------------------------------- /tests/uniqueness/uniqueness-error49.fut: -------------------------------------------------------------------------------- 1 | -- Do not let ascription screw up uniqueness/aliasing. 2 | -- == 3 | -- error: Consuming.*"xs" 4 | 5 | def f 't (x: t) = id (x : t) 6 | def main (xs: []i32) = f xs with [0] = 0 7 | -------------------------------------------------------------------------------- /tests/uniqueness/uniqueness-error54.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: aliased to some other component. 3 | 4 | def dup x = (x,x) 5 | 6 | def main (xs: []i32) : (*[]i32, *[]i32) = 7 | dup (copy xs) 8 | -------------------------------------------------------------------------------- /tests/uniqueness/uniqueness-error55.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: "y".*consumed 3 | 4 | def main n = 5 | let (a,b) = let y = iota n 6 | in (y,y) 7 | let a[0] = 0 8 | let b[0] = 0 9 | in (a,b) 10 | -------------------------------------------------------------------------------- /tests/uniqueness/uniqueness-error64.fut: -------------------------------------------------------------------------------- 1 | -- From #2007 2 | -- == 3 | -- error: Argument is consumed 4 | 5 | def main (xs: *[]i64) = scatter xs xs xs 6 | -------------------------------------------------------------------------------- /tests/uniqueness/uniqueness-error65.fut: -------------------------------------------------------------------------------- 1 | -- From #2067. 2 | -- == 3 | -- error: "xs".*not consumable 4 | 5 | def main (xs: *[]i32) = 6 | loop xs : []i32 for i < 10 do 7 | xs with [i] = i+1 8 | -------------------------------------------------------------------------------- /tests/uniqueness/uniqueness21.fut: -------------------------------------------------------------------------------- 1 | -- The array magically becomes unique! 2 | -- == 3 | 4 | def f (x: []i32): []i32 = x 5 | 6 | def main (a: *[]i32): *[]i32 = f a 7 | -------------------------------------------------------------------------------- /tests/uniqueness/uniqueness22.fut: -------------------------------------------------------------------------------- 1 | -- Once failed after internalisation. 2 | 3 | def main (arr: *[](i32, i32)) = 4 | let arr' = rotate 1 arr 5 | in arr' with [0] = (0,0) 6 | -------------------------------------------------------------------------------- /tests/uniqueness/uniqueness23.fut: -------------------------------------------------------------------------------- 1 | -- Could fail after internalisation. 2 | 3 | def consume (arr: *[](i32, i32)) = arr 4 | 5 | def main (arr: *[](i32, i32)) = 6 | let arr' = rotate 1 arr 7 | in consume arr 8 | -------------------------------------------------------------------------------- /tests/uniqueness/uniqueness24.fut: -------------------------------------------------------------------------------- 1 | def main (arr: *[]i32) = 2 | let a = arr[0] 3 | let arr' = rotate 1 arr 4 | let arr'[0] = 0 5 | let arr'[1] = a 6 | in arr' 7 | -------------------------------------------------------------------------------- /tests/uniqueness/uniqueness25.fut: -------------------------------------------------------------------------------- 1 | def main [n] (m: i32) (xs: [n]i32) : [n]i32 = 2 | let foo = 3 | loop xs = copy xs for _d < m do 4 | xs 5 | 6 | let foo[n-1] = 0 7 | 8 | in foo 9 | -------------------------------------------------------------------------------- /tests/uniqueness/uniqueness51.fut: -------------------------------------------------------------------------------- 1 | -- Overloaded numbers should not track aliases. 2 | 3 | def main = 4 | let arr = [3,7] 5 | let a = arr[0] 6 | let arr[0] = 0 7 | in a 8 | -------------------------------------------------------------------------------- /tests/uniqueness/uniqueness53.fut: -------------------------------------------------------------------------------- 1 | def main (xs: *[]i32) = 2 | let xs' = zip xs xs 3 | let xs'[0] = (0,0) 4 | in xs' 5 | -------------------------------------------------------------------------------- /tests/uniqueness/uniqueness54.fut: -------------------------------------------------------------------------------- 1 | def dupcopy (xs: []i32) : (*[]i32, *[]i32) = (copy xs, copy xs) 2 | 3 | def main xs : (*[]i32, *[]i32) = dupcopy xs 4 | -------------------------------------------------------------------------------- /tests/uniqueness/uniqueness55.fut: -------------------------------------------------------------------------------- 1 | -- Proper aliasing inference for function. 2 | 3 | let f xs = map (+1i32) xs 4 | 5 | def main (xss: *[][]i32) = 6 | let xss[0] = f xss[0] 7 | in xss 8 | -------------------------------------------------------------------------------- /tests/uniqueness/uniqueness56.fut: -------------------------------------------------------------------------------- 1 | -- #1687 2 | 3 | type t = {a:[10]i32, b:bool} 4 | 5 | def recUpdate (rec: *t) = rec.a with [0] = 1 6 | -------------------------------------------------------------------------------- /tests/uniqueness/uniqueness57.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- error: "f".*consumed 3 | 4 | def main [n] (xs: *[n]i32) = 5 | let f i = xs[i] 6 | in loop ys = xs for i < n do ys with [i] = f i 7 | -------------------------------------------------------------------------------- /tests/uniqueness/uniqueness58.fut: -------------------------------------------------------------------------------- 1 | def main to from (counts: *[]i32) (state: *[][]u8) = 2 | let state[to,counts[to]] = state[from,counts[from]-1] 3 | let counts[to] = counts[to] + 1 4 | in (counts, state) 5 | -------------------------------------------------------------------------------- /tests/uniqueness/uniqueness59.fut: -------------------------------------------------------------------------------- 1 | -- It is ok to consuming non-free variables 2 | -- == 3 | def consume (xs: *[]i64): i64 = xs[0] 4 | def f [n] (ns: [n]i64) (xs: [consume (iota 10)]f32) = xs[0] 5 | -------------------------------------------------------------------------------- /tests/uniqueness/uniqueness60.fut: -------------------------------------------------------------------------------- 1 | -- If consumption is on bounded var, no problem 2 | -- == 3 | -- warning: ^$ 4 | def consume (xs: *[]i64): i64 = xs[0] 5 | def f (n:i64) = iota (consume (iota n)) 6 | -------------------------------------------------------------------------------- /tests_adhoc/bad_input/.gitignore: -------------------------------------------------------------------------------- 1 | stderr 2 | bad_input 3 | bad_input.c 4 | -------------------------------------------------------------------------------- /tests_adhoc/bad_input/bad_input.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { 1i32 } 3 | 4 | let main (x: i64) = x 5 | -------------------------------------------------------------------------------- /tests_adhoc/eval/test.fut: -------------------------------------------------------------------------------- 1 | local def plus2_iota x = 2 | map (+ 2) (iota x) 3 | -------------------------------------------------------------------------------- /tests_adhoc/eval/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | futhark eval -f test.fut '1 + 1' 'iota 4' 'plus2_iota 15' 4 | -------------------------------------------------------------------------------- /tests_adhoc/hash/test.fut: -------------------------------------------------------------------------------- 1 | let main (x: bool) = x 2 | -------------------------------------------------------------------------------- /tests_adhoc/hash/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | [ $(futhark hash test.fut) = $(futhark hash ../hash/test.fut) ] 4 | -------------------------------------------------------------------------------- /tests_adhoc/literate_trace/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | rm -rf trace-img 6 | futhark literate trace.fut -v | tee | fgrep 'trace.fut:1:22-32: 1.000000 2.000000 3.000000' 7 | -------------------------------------------------------------------------------- /tests_adhoc/literate_trace/trace.fut: -------------------------------------------------------------------------------- 1 | def foo x = f32.sum (#[trace] x) 2 | 3 | -- > foo [1f32, 2f32, 3f32] 4 | -------------------------------------------------------------------------------- /tests_adhoc/nobench/.gitignore: -------------------------------------------------------------------------------- 1 | nobench 2 | nobench.c 3 | -------------------------------------------------------------------------------- /tests_adhoc/nobench/nobench.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { 2 } output { 4 } 3 | -- nobench input { 3 } output { 4 } 4 | 5 | entry main (x: i32) = x + 2 6 | -------------------------------------------------------------------------------- /tests_adhoc/nobench/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | futhark bench nobench.fut 6 | -------------------------------------------------------------------------------- /tests_adhoc/notest/.gitignore: -------------------------------------------------------------------------------- 1 | notest 2 | notest.c 3 | -------------------------------------------------------------------------------- /tests_adhoc/notest/notest.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- input { 2 } output { 4 } 3 | -- notest input { 3 } output { 4 } 4 | 5 | entry main (x: i32) = x + 2 6 | -------------------------------------------------------------------------------- /tests_adhoc/notest/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | futhark test notest.fut 6 | futhark test -i notest.fut 7 | -------------------------------------------------------------------------------- /tests_adhoc/profile/.gitignore: -------------------------------------------------------------------------------- 1 | prog 2 | prog.c 3 | prog.json 4 | prog.prof 5 | -------------------------------------------------------------------------------- /tests_adhoc/profile/prog.fut: -------------------------------------------------------------------------------- 1 | -- == 2 | -- entry: inc1 inc2 3 | -- input { [1,2,3,4] } 4 | 5 | entry inc1 (xs: []i32) = map (+1) xs 6 | entry inc2 (xs: []i32) = map (+2) xs 7 | -------------------------------------------------------------------------------- /tests_adhoc/script/.gitignore: -------------------------------------------------------------------------------- 1 | testout 2 | double 3 | double.c 4 | -------------------------------------------------------------------------------- /tests_adhoc/script/double.fut: -------------------------------------------------------------------------------- 1 | entry main = map (f32.*2) 2 | -------------------------------------------------------------------------------- /tests_adhoc/script/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | futhark script ./double.fut '$store "testout" (main [1,2,3])' 6 | 7 | [ "$(futhark dataset i + j 2 | 3 | def g = 4 | tabulate_2d 2 3 \i j -> 5 | i + j 6 | -------------------------------------------------------------------------------- /tests_fmt/expected/let_linebreak.fut: -------------------------------------------------------------------------------- 1 | -- If the binding is after a linebreak, then keep it there. 2 | 3 | def f x = 4 | let y = 5 | x + 2 6 | in y 7 | -------------------------------------------------------------------------------- /tests_fmt/expected/local.fut: -------------------------------------------------------------------------------- 1 | -- | top level. 2 | 3 | local 4 | -- | I am a doc comment. 5 | module type mt = { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /tests_fmt/expected/nested_letIn.fut: -------------------------------------------------------------------------------- 1 | -- Extra 'in' should be removed 2 | 3 | def main = 4 | let n = 10 5 | let m = 20 6 | in 0 7 | -------------------------------------------------------------------------------- /tests_fmt/expected/nested_letWith.fut: -------------------------------------------------------------------------------- 1 | -- extra 'in' should also be removed from with terms 2 | def main = 3 | let x = [1, 2] 4 | let x[0] = 2 5 | in x 6 | -------------------------------------------------------------------------------- /tests_fmt/expected/pat.fut: -------------------------------------------------------------------------------- 1 | def f ((+++): i32) = (+++) 2 | -------------------------------------------------------------------------------- /tests_fmt/expected/singlelines.fut: -------------------------------------------------------------------------------- 1 | def vecadd = map2 (f64.+) 2 | def vecmul = map2 (f64.*) 3 | -------------------------------------------------------------------------------- /tests_fmt/expected/sumtype.fut: -------------------------------------------------------------------------------- 1 | type t1 = #foo | #bar | #baz 2 | 3 | type t2 = 4 | #foo 5 | | #bar 6 | | #baz 7 | -------------------------------------------------------------------------------- /tests_fmt/expected/trailingComments2.fut: -------------------------------------------------------------------------------- 1 | def a = 2 | ( 0 3 | , -- Test 0 4 | 1 5 | ) 6 | 7 | -- Test 1 8 | 9 | def b = 1 10 | -------------------------------------------------------------------------------- /tests_fmt/expected/with.fut: -------------------------------------------------------------------------------- 1 | def record (x: (f32, f32)) = 2 | x with 0 = 42 3 | with 1 = 1337 4 | 5 | def array (x: *[]f32) = 6 | x with [0] = 42 7 | with [1] = 1337 8 | -------------------------------------------------------------------------------- /tests_fmt/header_comment.fut: -------------------------------------------------------------------------------- 1 | -- # This comment is the first and only thing in this file. 2 | -------------------------------------------------------------------------------- /tests_fmt/lastarg.fut: -------------------------------------------------------------------------------- 1 | def f = tabulate_2d 2 3 \i j -> i + j 2 | 3 | def g = tabulate_2d 2 3 \i j -> 4 | i + j 5 | -------------------------------------------------------------------------------- /tests_fmt/let_linebreak.fut: -------------------------------------------------------------------------------- 1 | -- If the binding is after a linebreak, then keep it there. 2 | 3 | def f x = 4 | let y = 5 | x + 2 6 | in y 7 | -------------------------------------------------------------------------------- /tests_fmt/local.fut: -------------------------------------------------------------------------------- 1 | -- | top level. 2 | 3 | local 4 | -- | I am a doc comment. 5 | module type mt = { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /tests_fmt/nested_letIn.fut: -------------------------------------------------------------------------------- 1 | -- Extra 'in' should be removed 2 | 3 | def main = 4 | let n = 10 in 5 | let m = 20 6 | in 0 7 | -------------------------------------------------------------------------------- /tests_fmt/nested_letWith.fut: -------------------------------------------------------------------------------- 1 | -- extra 'in' should also be removed from with terms 2 | def main = 3 | let x = [1, 2] 4 | let x[0] = 2 5 | in x 6 | -------------------------------------------------------------------------------- /tests_fmt/pat.fut: -------------------------------------------------------------------------------- 1 | def f ((+++): i32) = (+++) 2 | -------------------------------------------------------------------------------- /tests_fmt/singlelines.fut: -------------------------------------------------------------------------------- 1 | def vecadd = map2 (f64.+) 2 | def vecmul = map2 (f64.*) 3 | -------------------------------------------------------------------------------- /tests_fmt/sumtype.fut: -------------------------------------------------------------------------------- 1 | type t1 = #foo | #bar | #baz 2 | 3 | type t2 = 4 | #foo 5 | | #bar 6 | | #baz 7 | -------------------------------------------------------------------------------- /tests_fmt/trailingComments2.fut: -------------------------------------------------------------------------------- 1 | def a = 2 | (0 3 | -- Test 0 4 | ,1) -- Test 1 5 | 6 | def b = 1 -------------------------------------------------------------------------------- /tests_fmt/with.fut: -------------------------------------------------------------------------------- 1 | def record (x: (f32, f32)) = 2 | x with 0 = 42 3 | with 1 = 1337 4 | 5 | def array (x: *[]f32) = 6 | x with [0] = 42 with 7 | [1] = 1337 8 | -------------------------------------------------------------------------------- /tests_lib/c/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !*.fut 3 | !test_*.c 4 | -------------------------------------------------------------------------------- /tests_lib/c/b.fut: -------------------------------------------------------------------------------- 1 | type r = {x: bool} 2 | 3 | entry a (x: bool) : (i32, r) = (32, {x}) 4 | -------------------------------------------------------------------------------- /tests_lib/c/c.fut: -------------------------------------------------------------------------------- 1 | let main n = map (2+) (iota n) 2 | -------------------------------------------------------------------------------- /tests_lib/c/const_error.fut: -------------------------------------------------------------------------------- 1 | -- Errors in constants must be detectable. 2 | -- == 3 | -- input { 2 } 4 | -- error: false 5 | 6 | let bad = assert false 0i32 7 | 8 | let main x = x + bad 9 | -------------------------------------------------------------------------------- /tests_lib/c/e.fut: -------------------------------------------------------------------------------- 1 | -- Test that error states are not sticky from one call of an entry 2 | -- point to the next. 3 | 4 | let main (xs: []f32) (is: []i32) = 5 | map (\i -> xs[i]) is 6 | -------------------------------------------------------------------------------- /tests_lib/c/f.fut: -------------------------------------------------------------------------------- 1 | let main (xs: []i32) = map (+2) xs 2 | -------------------------------------------------------------------------------- /tests_lib/c/index.fut: -------------------------------------------------------------------------------- 1 | entry fun1 n = iota n 2 | entry fun2 n = tabulate_2d n n (\i j -> i + j) 3 | -------------------------------------------------------------------------------- /tests_lib/c/phantomsize.fut: -------------------------------------------------------------------------------- 1 | type size [n] = [0][n]() 2 | type~ state = size [] 3 | 4 | entry construct (n: i64) : state = [] : [][n]() 5 | 6 | entry destruct (s: state) : i64 = 7 | let [n] (_: size [n]) = s in n 8 | -------------------------------------------------------------------------------- /tests_lib/c/raw.fut: -------------------------------------------------------------------------------- 1 | entry main (xs: []i32) = map (+2) xs 2 | -------------------------------------------------------------------------------- /tests_lib/c/record_array.fut: -------------------------------------------------------------------------------- 1 | entry main (xs: []i32) (ys: []f32) = zip xs (zip ys ys) 2 | 3 | entry main2 (xs: [][]i32) (ys: []f32) = zip xs ys 4 | -------------------------------------------------------------------------------- /tests_lib/javascript/a.fut: -------------------------------------------------------------------------------- 1 | -- Simple library with the increment function 2 | 3 | entry incr (x : i32) = x + 1 4 | -------------------------------------------------------------------------------- /tests_lib/javascript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /tests_lib/python/.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | *.pyc 3 | *.py 4 | -------------------------------------------------------------------------------- /tests_lib/python/a.fut: -------------------------------------------------------------------------------- 1 | -- Test that error states are not sticky from one call of an entry 2 | -- point to the next. 3 | 4 | let main (xs: []f32) (is: []i32) = 5 | map (\i -> xs[i]) is 6 | -------------------------------------------------------------------------------- /tests_literate/.gitignore: -------------------------------------------------------------------------------- 1 | /* 2 | /*/ 3 | !*.fut 4 | !/expected/ 5 | !.gitignore 6 | !test.sh 7 | !data/ 8 | -------------------------------------------------------------------------------- /tests_literate/basic.fut: -------------------------------------------------------------------------------- 1 | -- Let us see if this works. 2 | let main x = x + 2 3 | 4 | -- > main 2 5 | 6 | -- > main 2f32 7 | 8 | --The lack of a final newline here is intentional 9 | let x = true -------------------------------------------------------------------------------- /tests_literate/coerce.fut: -------------------------------------------------------------------------------- 1 | def f = i64.sum 2 | 3 | def g = f64.sum 4 | 5 | -- > f [1,2,3] 6 | 7 | -- > g [1,2,3] 8 | -------------------------------------------------------------------------------- /tests_literate/data/array.in: -------------------------------------------------------------------------------- 1 | [1i32, 2, 3] 2 | -------------------------------------------------------------------------------- /tests_literate/data/array_and_value.in: -------------------------------------------------------------------------------- 1 | [1i32, 2, 3] 2 | 10i32 3 | -------------------------------------------------------------------------------- /tests_literate/expected/img_noentry.md: -------------------------------------------------------------------------------- 1 | ``` 2 | > :img $loadimg "../assets/ohyes.png" 3 | ``` 4 | 5 | ![](img_noentry-img/e66b70cae5b1b3df4bae3afa03f7ee7e-img.png) 6 | -------------------------------------------------------------------------------- /tests_literate/img_noentry.fut: -------------------------------------------------------------------------------- 1 | -- > :img $loadimg "../assets/ohyes.png" 2 | -------------------------------------------------------------------------------- /tests_literate/loaddata.fut: -------------------------------------------------------------------------------- 1 | -- > $loaddata "data/array.in" 2 | 3 | let add_scalar (y: i32) = map (+y) 4 | 5 | -- > let (xs, y) = $loaddata "data/array_and_value.in" in add_scalar y xs 6 | -------------------------------------------------------------------------------- /tests_literate/loadimg.fut: -------------------------------------------------------------------------------- 1 | let foo [n][m] (img: [n][m]u32): [n][m]u32 = 2 | map (map id) img 3 | 4 | -- > :img foo ($loadimg "../assets/ohyes.png") 5 | -------------------------------------------------------------------------------- /tests_literate/mono.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diku-dk/futhark/e4c272556d6dd5c0832b3e522c3e408cfb748141/tests_literate/mono.wav -------------------------------------------------------------------------------- /tests_literate/nonl.fut: -------------------------------------------------------------------------------- 1 | -- Note: it is intentional that this file does not include a final 2 | -- newline character. Do not add it! 3 | 4 | def main x = x + 1 5 | 6 | -- > main 1 -------------------------------------------------------------------------------- /tests_literate/stereo.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diku-dk/futhark/e4c272556d6dd5c0832b3e522c3e408cfb748141/tests_literate/stereo.wav -------------------------------------------------------------------------------- /tests_literate/tuple.fut: -------------------------------------------------------------------------------- 1 | entry f (x: i32, (y: i32, z: i32)) = x + y + z 2 | 3 | -- > f (1,(2,3)) 4 | 5 | entry g {x: i32, y: (i32,i32)} = x - y.0 + y.1 6 | 7 | -- > g {y=(7,2),x=10} 8 | -------------------------------------------------------------------------------- /tests_pkg/.gitignore: -------------------------------------------------------------------------------- 1 | lib 2 | futhark.pkg 3 | -------------------------------------------------------------------------------- /tests_pkg/futhark.pkg.0: -------------------------------------------------------------------------------- 1 | package github.com/sturluson/testpkg 2 | 3 | require { 4 | } 5 | -------------------------------------------------------------------------------- /tests_pkg/futhark.pkg.1: -------------------------------------------------------------------------------- 1 | package github.com/sturluson/testpkg 2 | 3 | require { 4 | github.com/athas/fut-foo 0.1.0 #d285563c25c5152b1ae80fc64de64ff2775fa733 5 | } 6 | -------------------------------------------------------------------------------- /tests_pkg/futhark.pkg.2: -------------------------------------------------------------------------------- 1 | package github.com/sturluson/testpkg 2 | 3 | require { 4 | github.com/athas/fut-foo 0.1.0 #d285563c25c5152b1ae80fc64de64ff2775fa733 5 | } 6 | -------------------------------------------------------------------------------- /tests_pkg/futhark.pkg.7: -------------------------------------------------------------------------------- 1 | package github.com/sturluson/testpkg 2 | 3 | require { 4 | github.com/athas/fut-baz 0.2.0 #44da85224224d37803976c1d30cedb1d2cd20b74 5 | } 6 | -------------------------------------------------------------------------------- /tests_pkg/futhark.pkg.8: -------------------------------------------------------------------------------- 1 | package github.com/sturluson/testpkg 2 | 3 | require { 4 | github.com/athas/fut-baz 0.2.0 #44da85224224d37803976c1d30cedb1d2cd20b74 5 | } 6 | -------------------------------------------------------------------------------- /tests_pkg/lib.10/github.com/athas/fut-bar/bar.fut: -------------------------------------------------------------------------------- 1 | let bar = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.10/github.com/athas/fut-foo/foo.fut: -------------------------------------------------------------------------------- 1 | let foo = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.10/github.com/athas/fut-foo@2/foo.fut: -------------------------------------------------------------------------------- 1 | module fut_baz = import "../fut-baz/baz" 2 | 3 | let foo = (0, 2, 0) 4 | let baz = fut_baz.baz 5 | -------------------------------------------------------------------------------- /tests_pkg/lib.11/github.com/athas/fut-bar/bar.fut: -------------------------------------------------------------------------------- 1 | let bar = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.11/github.com/athas/fut-foo/foo.fut: -------------------------------------------------------------------------------- 1 | let foo = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.11/github.com/athas/fut-foo@2/foo.fut: -------------------------------------------------------------------------------- 1 | module fut_baz = import "../fut-baz/baz" 2 | 3 | let foo = (0, 2, 0) 4 | let baz = fut_baz.baz 5 | -------------------------------------------------------------------------------- /tests_pkg/lib.12/github.com/athas/fut-bar/bar.fut: -------------------------------------------------------------------------------- 1 | let bar = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.12/github.com/athas/fut-foo/foo.fut: -------------------------------------------------------------------------------- 1 | let foo = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.12/github.com/athas/fut-foo@2/foo.fut: -------------------------------------------------------------------------------- 1 | module fut_baz = import "../fut-baz/baz" 2 | 3 | let foo = (0, 2, 0) 4 | let baz = fut_baz.baz 5 | -------------------------------------------------------------------------------- /tests_pkg/lib.12/github.com/athas/fut-quux/quux.fut: -------------------------------------------------------------------------------- 1 | let quux = "123" 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.13/github.com/athas/fut-bar/bar.fut: -------------------------------------------------------------------------------- 1 | let bar = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.13/github.com/athas/fut-foo/foo.fut: -------------------------------------------------------------------------------- 1 | let foo = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.13/github.com/athas/fut-foo@2/foo.fut: -------------------------------------------------------------------------------- 1 | module fut_baz = import "../fut-baz/baz" 2 | 3 | let foo = (0, 2, 0) 4 | let baz = fut_baz.baz 5 | -------------------------------------------------------------------------------- /tests_pkg/lib.13/github.com/athas/fut-quux/quux.fut: -------------------------------------------------------------------------------- 1 | let quux = "123" 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.14/github.com/athas/fut-bar/bar.fut: -------------------------------------------------------------------------------- 1 | let bar = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.14/github.com/athas/fut-foo/foo.fut: -------------------------------------------------------------------------------- 1 | let foo = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.14/github.com/athas/fut-foo@2/foo.fut: -------------------------------------------------------------------------------- 1 | module fut_baz = import "../fut-baz/baz" 2 | 3 | let foo = (0, 2, 0) 4 | let baz = fut_baz.baz 5 | -------------------------------------------------------------------------------- /tests_pkg/lib.14/github.com/athas/fut-quux/quux.fut: -------------------------------------------------------------------------------- 1 | -- This is not a version number, but this is also not a released 2 | -- version! 3 | let quux = "123" 4 | -------------------------------------------------------------------------------- /tests_pkg/lib.15/github.com/athas/fut-bar/bar.fut: -------------------------------------------------------------------------------- 1 | let bar = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.15/github.com/athas/fut-foo/foo.fut: -------------------------------------------------------------------------------- 1 | let foo = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.15/github.com/athas/fut-foo@2/foo.fut: -------------------------------------------------------------------------------- 1 | module fut_baz = import "../fut-baz/baz" 2 | 3 | let foo = (0, 2, 0) 4 | let baz = fut_baz.baz 5 | -------------------------------------------------------------------------------- /tests_pkg/lib.15/github.com/athas/fut-quux/quux.fut: -------------------------------------------------------------------------------- 1 | -- This is not a version number, but this is also not a released 2 | -- version! 3 | let quux = "123" 4 | -------------------------------------------------------------------------------- /tests_pkg/lib.16/github.com/athas/fut-bar/bar.fut: -------------------------------------------------------------------------------- 1 | let bar = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.16/github.com/athas/fut-foo/foo.fut: -------------------------------------------------------------------------------- 1 | let foo = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.16/github.com/athas/fut-foo@2/foo.fut: -------------------------------------------------------------------------------- 1 | module fut_baz = import "../fut-baz/baz" 2 | 3 | let foo = (0, 2, 0) 4 | let baz = fut_baz.baz 5 | -------------------------------------------------------------------------------- /tests_pkg/lib.16/github.com/athas/fut-quux/quux.fut: -------------------------------------------------------------------------------- 1 | -- This is not a version number, but this is also not a released 2 | -- version! 3 | let quux = "123" 4 | -------------------------------------------------------------------------------- /tests_pkg/lib.16/gitlab.com/athas/fut-gitlab/gitlab.fut: -------------------------------------------------------------------------------- 1 | let gitlab = (1, 0, 1) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.17/github.com/athas/fut-bar/bar.fut: -------------------------------------------------------------------------------- 1 | let bar = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.17/github.com/athas/fut-foo/foo.fut: -------------------------------------------------------------------------------- 1 | let foo = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.17/github.com/athas/fut-foo@2/foo.fut: -------------------------------------------------------------------------------- 1 | module fut_baz = import "../fut-baz/baz" 2 | 3 | let foo = (0, 2, 0) 4 | let baz = fut_baz.baz 5 | -------------------------------------------------------------------------------- /tests_pkg/lib.17/github.com/athas/fut-quux/quux.fut: -------------------------------------------------------------------------------- 1 | -- This is not a version number, but this is also not a released 2 | -- version! 3 | let quux = "123" 4 | -------------------------------------------------------------------------------- /tests_pkg/lib.18/github.com/athas/fut-bar/bar.fut: -------------------------------------------------------------------------------- 1 | let bar = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.18/github.com/athas/fut-foo/foo.fut: -------------------------------------------------------------------------------- 1 | let foo = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.18/github.com/athas/fut-foo@2/foo.fut: -------------------------------------------------------------------------------- 1 | module fut_baz = import "../fut-baz/baz" 2 | 3 | let foo = (0, 2, 0) 4 | let baz = fut_baz.baz 5 | -------------------------------------------------------------------------------- /tests_pkg/lib.18/github.com/athas/fut-quux/quux.fut: -------------------------------------------------------------------------------- 1 | -- This is not a version number, but this is also not a released 2 | -- version! 3 | let quux = "123" 4 | -------------------------------------------------------------------------------- /tests_pkg/lib.18/gitlab.com/athas/fut-gitlab/gitlab.fut: -------------------------------------------------------------------------------- 1 | -- Unreleased version. 2 | let gitlab = (1, 0, 1) 3 | -------------------------------------------------------------------------------- /tests_pkg/lib.2/github.com/athas/fut-foo/foo.fut: -------------------------------------------------------------------------------- 1 | let foo = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.3/github.com/athas/fut-foo/foo.fut: -------------------------------------------------------------------------------- 1 | let foo = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.4/github.com/athas/fut-baz/baz.fut: -------------------------------------------------------------------------------- 1 | module foo_mod = import "../fut-foo/foo" -- Naughty! 2 | 3 | let baz = (0, 1, 0) 4 | let foo = foo_mod.foo 5 | -------------------------------------------------------------------------------- /tests_pkg/lib.4/github.com/athas/fut-foo/foo.fut: -------------------------------------------------------------------------------- 1 | let foo = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.5/github.com/athas/fut-baz/baz.fut: -------------------------------------------------------------------------------- 1 | module foo_mod = import "../fut-foo/foo" -- Naughty! 2 | 3 | let baz = (0, 1, 0) 4 | let foo = foo_mod.foo 5 | -------------------------------------------------------------------------------- /tests_pkg/lib.5/github.com/athas/fut-foo/foo.fut: -------------------------------------------------------------------------------- 1 | let foo = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.6/github.com/athas/fut-bar/bar.fut: -------------------------------------------------------------------------------- 1 | let bar = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.6/github.com/athas/fut-foo/foo.fut: -------------------------------------------------------------------------------- 1 | module fut_bar = import "../../../github.com/athas/fut-bar/bar" 2 | 3 | let foo = (0, 2, 0) 4 | let bar = fut_bar.bar 5 | -------------------------------------------------------------------------------- /tests_pkg/lib.7/github.com/athas/fut-bar/bar.fut: -------------------------------------------------------------------------------- 1 | let bar = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.7/github.com/athas/fut-foo/foo.fut: -------------------------------------------------------------------------------- 1 | module fut_bar = import "../../../github.com/athas/fut-bar/bar" 2 | 3 | let foo = (0, 2, 0) 4 | let bar = fut_bar.bar 5 | -------------------------------------------------------------------------------- /tests_pkg/lib.8/github.com/athas/fut-bar/bar.fut: -------------------------------------------------------------------------------- 1 | let bar = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.8/github.com/athas/fut-foo/foo.fut: -------------------------------------------------------------------------------- 1 | let foo = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.9/github.com/athas/fut-bar/bar.fut: -------------------------------------------------------------------------------- 1 | let bar = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_pkg/lib.9/github.com/athas/fut-foo/foo.fut: -------------------------------------------------------------------------------- 1 | let foo = (0, 1, 0) 2 | -------------------------------------------------------------------------------- /tests_repl/.gitignore: -------------------------------------------------------------------------------- 1 | *.actual 2 | -------------------------------------------------------------------------------- /tests_repl/issue1347.fut: -------------------------------------------------------------------------------- 1 | entry blockify [n] (b: i64) (xs: [n][n]i32) 2 | = 3 | (xs :> [(n/b)*b][(n/b)*b]i32) 4 | |> unflatten 5 | |> map transpose 6 | |> map unflatten 7 | |> map (map transpose) 8 | -------------------------------------------------------------------------------- /tests_repl/issue1347.in: -------------------------------------------------------------------------------- 1 | let blocked = blockify 2 (copy <| unflatten (map i32.i64 <| iota (8*8))) 2 | let pre_transpose = map (map transpose) blocked 3 | -------------------------------------------------------------------------------- /tests_repl/issue1347.out: -------------------------------------------------------------------------------- 1 | [0]> [1]> [2]> Leaving 'futhark repl'. 2 | -------------------------------------------------------------------------------- /tests_repl/local.fut: -------------------------------------------------------------------------------- 1 | local def secret : i32 = 42 2 | -------------------------------------------------------------------------------- /tests_repl/local.in: -------------------------------------------------------------------------------- 1 | secret 2 | -------------------------------------------------------------------------------- /tests_repl/local.out: -------------------------------------------------------------------------------- 1 | [0]> 42 2 | [1]> Leaving 'futhark repl'. 3 | -------------------------------------------------------------------------------- /tools/.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ -------------------------------------------------------------------------------- /tools/node-simd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | node --experimental-wasm-simd "$@" 4 | -------------------------------------------------------------------------------- /tools/node-threaded.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | node --experimental-wasm-threads --experimental-wasm-simd "$@" 4 | -------------------------------------------------------------------------------- /tools/release/skeleton/config.mk: -------------------------------------------------------------------------------- 1 | # Customize below to fit your system 2 | 3 | # paths 4 | PREFIX ?= /usr/local 5 | MANPREFIX = ${PREFIX}/share/man 6 | --------------------------------------------------------------------------------