├── .github └── workflows │ ├── build-and-test.yml │ ├── build_and_install_libclc.sh │ ├── build_bugle.sh │ ├── build_gpuverify.sh │ ├── download_and_symlink_cvc4.sh │ ├── download_and_symlink_z3.sh │ ├── gvfindtools.py │ ├── symlink_llvm_tools.sh │ └── test_gpuverify.sh ├── .gitignore ├── BoogieBinaries ├── BoogieAbsInt.dll ├── BoogieBasetypes.dll ├── BoogieCodeContractsExtender.dll ├── BoogieConcurrency.dll ├── BoogieCore.dll ├── BoogieDoomed.dll ├── BoogieExecutionEngine.dll ├── BoogieGraph.dll ├── BoogieHoudini.dll ├── BoogieModel.dll ├── BoogieParserHelper.dll ├── BoogieVCExpr.dll ├── BoogieVCGeneration.dll └── Provers.SMTLib.dll ├── Documentation ├── Makefile ├── advanced_features.rst ├── basic_usage.rst ├── conf.py ├── developer_guide.rst ├── examples │ ├── add-neighbour-buggy-error.txt │ ├── add-neighbour-buggy.cl │ ├── add-neighbour-correct-output.txt │ ├── add-neighbour-correct.cl │ ├── assert-as-invariant-error.txt │ ├── assert-as-invariant.cl │ ├── barrier-div-cuda-error.txt │ ├── barrier-div-cuda.cu │ ├── barrier-div-opencl-error.txt │ ├── barrier-div-opencl.cl │ ├── failing-assert-error.txt │ ├── failing-assert.cu │ ├── inter-group-error.txt │ ├── inter-group.cu │ ├── intra-group-error.txt │ ├── intra-group.cl │ ├── invariant-do-while-loop.cl │ ├── invariant-for-loop-error.txt │ ├── invariant-for-loop.cl │ ├── invariant-goto-loop.cl │ ├── needs-requires-error.txt │ ├── needs-requires.cu │ └── with-requires.cu ├── index.rst ├── installation.rst ├── json_format.rst ├── limitations.rst ├── make.bat ├── overview.rst ├── trouble_shooting.rst └── tutorial.rst ├── GPUVerify.bat ├── GPUVerify.py ├── GPUVerify.sln ├── GPUVerifyBoogieDriver ├── GPUVerifyBoogieDriver.cs ├── GPUVerifyBoogieDriver.csproj ├── Properties │ └── AssemblyInfo.cs └── packages.config ├── GPUVerifyCruncher ├── BitVector.cs ├── BoogieInterpreter.cs ├── ExprTree.cs ├── GPU.cs ├── GPUVerifyCruncher.cs ├── GPUVerifyCruncher.csproj ├── GPUVerifyCruncherCommandLineOptions.cs ├── Main.cs ├── Memory.cs ├── Print.cs ├── Properties │ └── AssemblyInfo.cs ├── RefutationEngine.cs └── packages.config ├── GPUVerifyLib ├── AccessType.cs ├── CheckForQuantifiersVisitor.cs ├── GPUVerifyErrorReporter.cs ├── GPUVerifyLib.csproj ├── GVCommandLineOptions.cs ├── KernelAnalyser.cs ├── Properties │ └── AssemblyInfo.cs ├── RaceInstrumentationUtil.cs ├── SourceLocationInfo.cs ├── ToolExitCodes.cs ├── Utilities.cs ├── VariablesOccurringInExpressionVisitor.cs └── packages.config ├── GPUVerifyScript ├── __init__.py ├── argument_parser.py ├── constants.py ├── error_codes.py ├── json_loader.py └── util.py ├── GPUVerifyVCGen ├── AbstractHoudiniTransformation.cs ├── AccessCollector.cs ├── AccessRecord.cs ├── AdversarialAbstraction.cs ├── ArrayBoundsChecker.cs ├── ArrayControlFlowAnalyser.cs ├── AsymmetricExpressionFinder.cs ├── BarrierIntervalsAnalysis.cs ├── BarrierInvariantDescriptor.cs ├── BinaryBarrierInvariantDescriptor.cs ├── CallSiteAnalyser.cs ├── ConstantWriteCollector.cs ├── ConstantWriteInstrumenter.cs ├── ExpressionSimplifier.cs ├── GPUVerifier.cs ├── GPUVerifyVCGen.cs ├── GPUVerifyVCGen.csproj ├── GPUVerifyVCGenCommandLineOptions.cs ├── IConstantWriteInstrumenter.cs ├── IKernelArrayInfo.cs ├── INoAccessInstrumenter.cs ├── IRaceInstrumenter.cs ├── IRegion.cs ├── IntegerRepresentation.cs ├── InvariantGenerationRules │ ├── InvariantGenerationRule.cs │ └── PowerOfTwoInvariantGenerator.cs ├── KernelArrayInfoLists.cs ├── KernelDualiser.cs ├── LiteralIndexedArrayEliminator.cs ├── LoopInvariantGenerator.cs ├── MayBePowerOfTwoAnalyser.cs ├── NoAccessInstrumenter.cs ├── NullRaceInstrumenter.cs ├── OriginalRaceInstrumenter.cs ├── Properties │ └── AssemblyInfo.cs ├── RaceInstrumenter.cs ├── ReadCollector.cs ├── ReducedStrengthAnalysisRegion.cs ├── RelationalPowerOfTwoAnalyser.cs ├── SmartBlockPredicator.cs ├── StrideConstraint.cs ├── UnaryBarrierInvariantDescriptor.cs ├── UniformityAnalyser.cs ├── UninterpretedFunctionRemover.cs ├── UnstructuredRegion.cs ├── VariableDefinitionAnalysisRegion.cs ├── VariableDualiser.cs ├── WatchdogRaceInstrumenter.cs ├── WriteCollector.cs └── packages.config ├── LICENSE.TXT ├── README.md ├── StyleCop.ruleset ├── deploy.py ├── getversion.py ├── gpuverify ├── gvfindtools.templates ├── gvfindtools.dev.py └── gvfindtoolsdeploy.py ├── gvtester.py ├── license_banner.txt ├── testsuite ├── CUDA │ ├── align │ │ └── kernel.cu │ ├── always_inline │ │ └── kernel.cu │ ├── annotation_tests │ │ ├── test_all │ │ │ └── kernel.cu │ │ ├── test_assert │ │ │ └── kernel.cu │ │ ├── test_assume │ │ │ └── kernel.cu │ │ ├── test_at_most_one │ │ │ └── kernel.cu │ │ ├── test_axiom │ │ │ └── kernel.cu │ │ ├── test_contract │ │ │ └── kernel.cu │ │ ├── test_distinct │ │ │ └── kernel.cu │ │ ├── test_enabled_and_uniform │ │ │ └── kernel.cu │ │ ├── test_ensures │ │ │ └── kernel.cu │ │ ├── test_for_loop_invariant │ │ │ └── kernel.cu │ │ ├── test_no_readwrite │ │ │ └── kernel.cu │ │ ├── test_norace │ │ │ └── kernel.cu │ │ ├── test_requires │ │ │ └── kernel.cu │ │ └── test_while_loop_invariant │ │ │ └── kernel.cu │ ├── argument_promotion │ │ └── kernel.cu │ ├── atomics │ │ ├── add_one │ │ │ └── kernel.cu │ │ ├── add_tid │ │ │ └── kernel.cu │ │ ├── add_zero │ │ │ └── kernel.cu │ │ ├── definitions │ │ │ └── kernel.cu │ │ ├── device_global │ │ │ └── kernel.cu │ │ ├── pointer_add │ │ │ └── kernel.cu │ │ └── test_abstraction_enforced │ │ │ └── kernel.cu │ ├── barrierconditionalkernelparam │ │ └── kernel.cu │ ├── basic1 │ │ └── kernel.cu │ ├── basicbarrier │ │ └── kernel.cu │ ├── basicglobalarray │ │ └── kernel.cu │ ├── casttofloat │ │ └── kernel.cu │ ├── cooperative_groups │ │ ├── fail │ │ │ ├── block_divergence_grid_group │ │ │ │ └── kernel.cu │ │ │ ├── divergence_grid_group │ │ │ │ └── kernel.cu │ │ │ ├── divergence_thread_block │ │ │ │ └── kernel.cu │ │ │ └── race │ │ │ │ └── kernel.cu │ │ └── pass │ │ │ ├── block_barrier │ │ │ └── kernel.cu │ │ │ ├── grid_barrier │ │ │ └── kernel.cu │ │ │ └── multiple_barriers │ │ │ └── kernel.cu │ ├── ctimesgid │ │ └── kernel.cu │ ├── ctimeslid │ │ └── kernel.cu │ ├── cuda_arch │ │ └── kernel.cu │ ├── curand_tests │ │ ├── fail │ │ │ ├── curand_mtgp32_block_race │ │ │ │ └── kernel.cu │ │ │ ├── curand_mtgp32_race │ │ │ │ └── kernel.cu │ │ │ ├── curand_race │ │ │ │ └── kernel.cu │ │ │ └── init_race │ │ │ │ └── kernel.cu │ │ └── pass │ │ │ ├── curand │ │ │ └── kernel.cu │ │ │ └── curand_mtgp32 │ │ │ └── kernel.cu │ ├── fail_tests │ │ ├── race_on_shared │ │ │ └── kernel.cu │ │ └── shared_int │ │ │ └── kernel.cu │ ├── floatcastrequired │ │ └── kernel.cu │ ├── floatrelationalop │ │ └── kernel.cu │ ├── fresh_arrays │ │ ├── fail │ │ │ ├── array │ │ │ │ └── kernel.cu │ │ │ ├── inherit │ │ │ │ └── kernel.cu │ │ │ ├── struct_char │ │ │ │ └── kernel.cu │ │ │ ├── struct_float │ │ │ │ └── kernel.cu │ │ │ └── struct_nested │ │ │ │ └── kernel.cu │ │ └── pass │ │ │ ├── array │ │ │ └── kernel.cu │ │ │ ├── inherit │ │ │ └── kernel.cu │ │ │ ├── struct_char │ │ │ └── kernel.cu │ │ │ └── struct_float │ │ │ └── kernel.cu │ ├── function_pointers │ │ ├── basic_argument_fail │ │ │ └── kernel.cu │ │ ├── basic_argument_pass │ │ │ └── kernel.cu │ │ ├── basic_assignment_fail │ │ │ └── kernel.cu │ │ ├── basic_assignment_pass │ │ │ └── kernel.cu │ │ ├── basic_statement │ │ │ └── kernel.cu │ │ ├── check_return_value │ │ │ └── kernel.cu │ │ ├── constant_value │ │ │ └── kernel.cu │ │ ├── funcptr_lt │ │ │ └── kernel.cu │ │ ├── funcptr_to_ptr │ │ │ ├── axioms.bpl │ │ │ └── kernel.cu │ │ ├── funcptr_to_ptr_add │ │ │ ├── axioms.bpl │ │ │ └── kernel.cu │ │ ├── pass_struct │ │ │ ├── call │ │ │ │ └── kernel.cu │ │ │ ├── requires │ │ │ │ └── kernel.cu │ │ │ └── requires_call │ │ │ │ └── kernel.cu │ │ ├── return_value │ │ │ └── kernel.cu │ │ ├── soundness_issue │ │ │ └── kernel.cu │ │ └── unknown_function │ │ │ └── kernel.cu │ ├── globalarray │ │ └── fail │ │ │ └── kernel.cu │ ├── inheritance_struct_simplify │ │ ├── direct │ │ │ └── kernel.cu │ │ └── indirect │ │ │ └── kernel.cu │ ├── large_constant_array │ │ └── kernel.cu │ ├── local2darrayaccess │ │ └── kernel.cu │ ├── localarrayaccess │ │ └── kernel.cu │ ├── loop_unwind │ │ └── kernel.cu │ ├── memcpy │ │ ├── arrayofstruct │ │ │ └── kernel.cu │ │ ├── fail_arrayofstruct │ │ │ └── kernel.cu │ │ ├── fail_overstep │ │ │ └── kernel.cu │ │ ├── lentoobig │ │ │ └── kernel.cu │ │ ├── lentoosmall │ │ │ └── kernel.cu │ │ ├── mismatch │ │ │ └── kernel.cu │ │ ├── notexactdiv │ │ │ └── kernel.cu │ │ ├── null_dst │ │ │ └── kernel.cu │ │ ├── null_src │ │ │ └── kernel.cu │ │ └── unhandled_varlen │ │ │ └── kernel.cu │ ├── memcpy_simplification │ │ ├── array_element_passed_to_call1 │ │ │ └── kernel.cu │ │ ├── array_element_passed_to_call2 │ │ │ └── kernel.cu │ │ ├── global_passed_to_call │ │ │ └── kernel.cu │ │ ├── i8_element_global_passed_to_call1 │ │ │ └── kernel.cu │ │ ├── i8_element_global_passed_to_call2 │ │ │ └── kernel.cu │ │ ├── i8_element_parameter_passed_to_call │ │ │ └── kernel.cu │ │ ├── parameter_passed_to_call │ │ │ └── kernel.cu │ │ └── shared_element_passed_to_call │ │ │ └── kernel.cu │ ├── memset │ │ ├── initstruct │ │ │ └── kernel.cu │ │ ├── null_dst │ │ │ └── kernel.cu │ │ ├── unhandled_varlen │ │ │ └── kernel.cu │ │ └── unhandled_varval │ │ │ └── kernel.cu │ ├── memset_simplification │ │ └── kernel.cu │ ├── misc │ │ ├── fail │ │ │ ├── miscfail1 │ │ │ │ └── kernel.cu │ │ │ ├── miscfail2 │ │ │ │ └── kernel.cu │ │ │ ├── miscfail3 │ │ │ │ └── kernel.cu │ │ │ ├── miscfail4 │ │ │ │ └── kernel.cu │ │ │ ├── miscfail5 │ │ │ │ └── kernel.cu │ │ │ ├── miscfail6 │ │ │ │ └── kernel.cu │ │ │ ├── miscfail7 │ │ │ │ └── kernel.cu │ │ │ └── miscfail8 │ │ │ │ └── kernel.cu │ │ └── pass │ │ │ ├── misc1 │ │ │ └── kernel.cu │ │ │ ├── misc2 │ │ │ └── kernel.cu │ │ │ ├── misc3 │ │ │ └── kernel.cu │ │ │ ├── misc4 │ │ │ └── kernel.cu │ │ │ ├── misc5 │ │ │ └── kernel.cu │ │ │ ├── misc6 │ │ │ └── kernel.cu │ │ │ ├── misc7 │ │ │ └── kernel.cu │ │ │ └── misc8 │ │ │ └── kernel.cu │ ├── mul24 │ │ └── kernel.cu │ ├── multiplelocals │ │ └── kernel.cu │ ├── nestedinline │ │ └── kernel.cu │ ├── nonpointerparameter1 │ │ └── kernel.cu │ ├── nonpointerparameter2 │ │ └── kernel.cu │ ├── noraceduetoreturn │ │ └── kernel.cu │ ├── notunaryoptest │ │ └── kernel.cu │ ├── param_values │ │ ├── value_causing_race │ │ │ └── kernel.cu │ │ └── value_in_assert │ │ │ └── kernel.cu │ ├── pointeranalysistests │ │ ├── testbasicaliasing │ │ │ └── kernel.cu │ │ ├── testinterprocedural │ │ │ └── kernel.cu │ │ ├── testinterprocedural2 │ │ │ └── kernel.cu │ │ └── testinterprocedural3 │ │ │ └── kernel.cu │ ├── pointers_in_structs │ │ ├── test1 │ │ │ └── kernel.cu │ │ ├── test2 │ │ │ └── kernel.cu │ │ ├── test3 │ │ │ └── kernel.cu │ │ └── test4 │ │ │ └── kernel.cu │ ├── pointertests │ │ ├── cast │ │ │ └── kernel.cu │ │ ├── scanlargelike │ │ │ └── kernel.cu │ │ ├── test1 │ │ │ └── kernel.cu │ │ ├── test10 │ │ │ └── kernel.cu │ │ ├── test11 │ │ │ └── kernel.cu │ │ ├── test12 │ │ │ └── kernel.cu │ │ ├── test13 │ │ │ └── kernel.cu │ │ ├── test14 │ │ │ └── kernel.cu │ │ ├── test2 │ │ │ └── kernel.cu │ │ ├── test3 │ │ │ └── kernel.cu │ │ ├── test4 │ │ │ └── kernel.cu │ │ ├── test5 │ │ │ └── kernel.cu │ │ ├── test6 │ │ │ └── kernel.cu │ │ ├── test7 │ │ │ └── kernel.cu │ │ ├── test8 │ │ │ └── kernel.cu │ │ ├── test9 │ │ │ └── kernel.cu │ │ ├── test_bad_pointer_procedure_call │ │ │ └── kernel.cu │ │ ├── test_copy_between_memory_spaces │ │ │ └── kernel.cu │ │ ├── test_copy_between_pointers │ │ │ └── kernel.cu │ │ └── test_pass_value_from_array │ │ │ └── kernel.cu │ ├── predication │ │ ├── test1 │ │ │ └── kernel.cu │ │ └── test2 │ │ │ └── kernel.cu │ ├── reduced_strength_blockwise │ │ └── kernel.cu │ ├── reduced_strength_with_requires │ │ └── kernel.cu │ ├── return_val │ │ ├── char │ │ │ └── kernel.cu │ │ └── longlong │ │ │ └── kernel.cu │ ├── scope │ │ └── kernel.cu │ ├── simpleparampassing │ │ └── kernel.cu │ ├── simplereturn │ │ └── kernel.cu │ ├── store_in_byval_function │ │ └── kernel.cu │ ├── struct │ │ └── kernel.cu │ ├── ternarytest │ │ └── kernel.cu │ ├── ternarytest2 │ │ └── kernel.cu │ ├── test_for_get_group_id │ │ └── kernel.cu │ ├── threadfence │ │ └── kernel.cu │ ├── transitiveclosure │ │ └── kernel.cu │ ├── unusedreturn │ │ └── kernel.cu │ ├── warpsize │ │ └── kernel.cu │ └── warpsync │ │ ├── 2d │ │ └── kernel.cu │ │ ├── bad_inter_group │ │ └── kernel.cu │ │ ├── broken_shuffle │ │ └── kernel.cu │ │ ├── equality_abstraction_issue │ │ └── kernel.cu │ │ ├── intragroup_scan │ │ └── kernel.cu │ │ ├── refined_equality_abstraction │ │ └── kernel.cu │ │ ├── scan_warp │ │ └── kernel.cu │ │ └── shuffle │ │ └── kernel.cu ├── OpenCL │ ├── abstract_add │ │ ├── associativity │ │ │ ├── axioms.bpl │ │ │ └── kernel.cl │ │ ├── associativity_char │ │ │ ├── axioms.bpl │ │ │ └── kernel.cl │ │ ├── associativity_short │ │ │ ├── axioms.bpl │ │ │ └── kernel.cl │ │ ├── fail_decreasing │ │ │ ├── axioms.bpl │ │ │ └── kernel.cl │ │ ├── increasing │ │ │ ├── axioms.bpl │ │ │ └── kernel.cl │ │ └── zero │ │ │ ├── axioms.bpl │ │ │ └── kernel.cl │ ├── addressofinit │ │ └── kernel.cl │ ├── addressofread │ │ └── kernel.cl │ ├── alignment │ │ ├── initialisation │ │ │ └── kernel.cl │ │ ├── int3int4 │ │ │ └── kernel.cl │ │ └── race_location │ │ │ └── kernel.cl │ ├── always_inline │ │ └── kernel.cl │ ├── annotation_tests │ │ ├── fail_assert_false │ │ │ └── kernel.cl │ │ ├── fail_assume_true │ │ │ └── kernel.cl │ │ ├── fail_function_wide_invariant │ │ │ └── kernel.cl │ │ ├── fail_ptr_offset │ │ │ └── kernel.cl │ │ ├── fail_read_offset_global │ │ │ └── kernel.cl │ │ ├── global_ensures │ │ │ ├── fail │ │ │ │ └── kernel.cl │ │ │ └── pass │ │ │ │ └── kernel.cl │ │ ├── global_requires │ │ │ ├── fail │ │ │ │ └── kernel.cl │ │ │ └── pass │ │ │ │ └── kernel.cl │ │ ├── invariant_specification_mistakes │ │ │ ├── nowhere_near_loop_head │ │ │ │ └── kernel.cl │ │ │ ├── short_circuit_and │ │ │ │ └── kernel.cl │ │ │ ├── short_circuit_or │ │ │ │ └── kernel.cl │ │ │ └── short_circuit_ternary │ │ │ │ └── kernel.cl │ │ ├── invariants_as_candidates │ │ │ └── kernel.cl │ │ ├── ite │ │ │ └── kernel.cl │ │ ├── no_annotations │ │ │ └── kernel.cl │ │ ├── only_requires │ │ │ └── kernel.cl │ │ ├── shared_state_invariant_tests │ │ │ ├── shared_state_two_arrays │ │ │ │ └── kernel.cl │ │ │ └── simple_shared_state_invariant │ │ │ │ └── kernel.cl │ │ ├── specification_tests │ │ │ ├── fail │ │ │ │ └── bad_write │ │ │ │ │ └── kernel.cl │ │ │ └── pass │ │ │ │ ├── simple_spec │ │ │ │ └── kernel.cl │ │ │ │ ├── vacuous_spec │ │ │ │ └── kernel.cl │ │ │ │ └── value_related_spec │ │ │ │ └── kernel.cl │ │ ├── test_all │ │ │ └── kernel.cl │ │ ├── test_assert │ │ │ └── kernel.cl │ │ ├── test_assert_true │ │ │ └── kernel.cl │ │ ├── test_assume │ │ │ └── kernel.cl │ │ ├── test_assume_false │ │ │ └── kernel.cl │ │ ├── test_axiom │ │ │ └── kernel.cl │ │ ├── test_candidate_global_invariant │ │ │ └── kernel.cl │ │ ├── test_candidate_invariant │ │ │ └── kernel.cl │ │ ├── test_contract │ │ │ └── kernel.cl │ │ ├── test_distinct │ │ │ └── kernel.cl │ │ ├── test_enabled_and_uniform │ │ │ └── kernel.cl │ │ ├── test_ensures │ │ │ └── kernel.cl │ │ ├── test_exclusive │ │ │ └── kernel.cl │ │ ├── test_for_loop_invariant │ │ │ └── kernel.cl │ │ ├── test_function_wide_invariant │ │ │ └── kernel.cl │ │ ├── test_loop_invariant_then_assert │ │ │ └── kernel.cl │ │ ├── test_loop_invariant_then_assert2 │ │ │ └── kernel.cl │ │ ├── test_old │ │ │ └── kernel.cl │ │ ├── test_precondition_on_kernel │ │ │ └── kernel.cl │ │ ├── test_ptr_offset │ │ │ └── kernel.cl │ │ ├── test_read_global │ │ │ └── kernel.cl │ │ ├── test_read_global_fail │ │ │ └── kernel.cl │ │ ├── test_read_local │ │ │ └── kernel.cl │ │ ├── test_read_local_fail │ │ │ └── kernel.cl │ │ ├── test_read_offset │ │ │ └── kernel.cl │ │ ├── test_read_offset_global │ │ │ └── kernel.cl │ │ ├── test_requires │ │ │ └── kernel.cl │ │ ├── test_while_loop_invariant │ │ │ └── kernel.cl │ │ ├── test_write_global │ │ │ └── kernel.cl │ │ ├── test_write_global_fail │ │ │ └── kernel.cl │ │ ├── test_write_local │ │ │ └── kernel.cl │ │ └── test_write_local_fail │ │ │ └── kernel.cl │ ├── array_bounds_tests │ │ ├── array_in_array │ │ │ └── kernel.cl │ │ ├── array_in_array_2 │ │ │ └── kernel.cl │ │ ├── array_in_array_param │ │ │ └── kernel.cl │ │ ├── multi_dim_array │ │ │ └── kernel.cl │ │ ├── multi_dim_array_fail_upper │ │ │ └── kernel.cl │ │ ├── negative_index_multi_dim │ │ │ └── kernel.cl │ │ ├── negative_index_multi_dim_fail │ │ │ └── kernel.cl │ │ ├── private_array │ │ │ └── kernel.cl │ │ ├── realign_simple │ │ │ └── kernel.cl │ │ ├── realign_simple_fail │ │ │ └── kernel.cl │ │ ├── simple_array │ │ │ └── kernel.cl │ │ ├── simple_array_fail_lower │ │ │ └── kernel.cl │ │ ├── simple_array_fail_upper │ │ │ └── kernel.cl │ │ └── simple_array_fail_var │ │ │ └── kernel.cl │ ├── arraycopy │ │ └── kernel.cl │ ├── asymmetric_asserts │ │ ├── fail │ │ │ └── kernel.cl │ │ └── pass │ │ │ └── kernel.cl │ ├── async_work_group_copy │ │ ├── fail │ │ │ ├── test1 │ │ │ │ └── kernel.cl │ │ │ ├── test10 │ │ │ │ └── kernel.cl │ │ │ ├── test11 │ │ │ │ └── kernel.cl │ │ │ ├── test12 │ │ │ │ └── kernel.cl │ │ │ ├── test13 │ │ │ │ └── kernel.cl │ │ │ ├── test14 │ │ │ │ └── kernel.cl │ │ │ ├── test15 │ │ │ │ └── kernel.cl │ │ │ ├── test16 │ │ │ │ └── kernel.cl │ │ │ ├── test17 │ │ │ │ └── kernel.cl │ │ │ ├── test18 │ │ │ │ └── kernel.cl │ │ │ ├── test2 │ │ │ │ └── kernel.cl │ │ │ ├── test3 │ │ │ │ └── kernel.cl │ │ │ ├── test4 │ │ │ │ └── kernel.cl │ │ │ ├── test5 │ │ │ │ └── kernel.cl │ │ │ ├── test6 │ │ │ │ └── kernel.cl │ │ │ ├── test7 │ │ │ │ └── kernel.cl │ │ │ ├── test8 │ │ │ │ └── kernel.cl │ │ │ └── test9 │ │ │ │ └── kernel.cl │ │ └── pass │ │ │ ├── test1 │ │ │ └── kernel.cl │ │ │ ├── test2 │ │ │ └── kernel.cl │ │ │ ├── test3 │ │ │ └── kernel.cl │ │ │ ├── test4 │ │ │ └── kernel.cl │ │ │ ├── test5 │ │ │ └── kernel.cl │ │ │ ├── test6 │ │ │ └── kernel.cl │ │ │ ├── test7 │ │ │ └── kernel.cl │ │ │ ├── test8 │ │ │ └── kernel.cl │ │ │ └── test9 │ │ │ └── kernel.cl │ ├── atomics │ │ ├── atomic_read_race │ │ │ └── kernel.cl │ │ ├── counter │ │ │ └── kernel.cl │ │ ├── definitions_atom_int │ │ │ └── kernel.cl │ │ ├── definitions_float │ │ │ └── kernel.cl │ │ ├── definitions_int │ │ │ └── kernel.cl │ │ ├── definitions_long │ │ │ └── kernel.cl │ │ ├── displaced │ │ │ └── kernel.cl │ │ ├── equality_fail │ │ │ └── kernel.cl │ │ ├── forloop │ │ │ └── kernel.cl │ │ ├── histo │ │ │ └── kernel.cl │ │ ├── mismatched_types │ │ │ ├── int_add_with_float │ │ │ │ └── kernel.cl │ │ │ ├── int_add_with_long │ │ │ │ └── kernel.cl │ │ │ └── int_add_with_short │ │ │ │ └── kernel.cl │ │ ├── pointers │ │ │ └── kernel.cl │ │ └── refined_atomic_abstraction │ │ │ ├── access_in_loop │ │ │ └── kernel.cl │ │ │ ├── bad_local_counters │ │ │ └── kernel.cl │ │ │ ├── check_used_treated_ok │ │ │ └── kernel.cl │ │ │ ├── intra_access_in_loop │ │ │ └── kernel.cl │ │ │ ├── intra_local_counters │ │ │ └── kernel.cl │ │ │ ├── many_accesses │ │ │ └── kernel.cl │ │ │ ├── one_access │ │ │ └── kernel.cl │ │ │ └── predication │ │ │ └── kernel.cl │ ├── barrier_intervals │ │ ├── test1 │ │ │ └── kernel.cl │ │ ├── test2 │ │ │ └── kernel.cl │ │ ├── test3 │ │ │ └── kernel.cl │ │ └── test4 │ │ │ └── kernel.cl │ ├── barrier_invariants │ │ ├── add_zero │ │ │ └── kernel.cl │ │ ├── all_different │ │ │ └── kernel.cl │ │ ├── all_different_loop │ │ │ └── kernel.cl │ │ ├── conditional_barrier_invariant │ │ │ └── kernel.cl │ │ ├── fail │ │ │ └── kernel.cl │ │ ├── ghost_array │ │ │ └── kernel.cl │ │ ├── global_array │ │ │ └── kernel.cl │ │ ├── jeroen_bug │ │ │ └── kernel.cl │ │ ├── no_access_check │ │ │ └── kernel.cl │ │ ├── ternary │ │ │ └── kernel.cl │ │ ├── test_all_unary_high │ │ │ └── kernel.cl │ │ ├── test_all_unary_low │ │ │ └── kernel.cl │ │ ├── tid_barrier_invariant │ │ │ └── kernel.cl │ │ └── wrap_around │ │ │ └── kernel.cl │ ├── barrierconditionalkernelparam │ │ └── kernel.cl │ ├── basic1 │ │ └── kernel.cl │ ├── basicbarrier │ │ └── kernel.cl │ ├── basicglobalarray │ │ └── kernel.cl │ ├── benign_race_tests │ │ ├── fail │ │ │ ├── writeafterread_addition │ │ │ │ └── kernel.cl │ │ │ ├── writeafterread_otherval │ │ │ │ └── kernel.cl │ │ │ ├── writereadarray_equality │ │ │ │ └── kernel.cl │ │ │ ├── writetiddiv64_offbyone │ │ │ │ └── kernel.cl │ │ │ ├── writewritearray_adversarial │ │ │ │ └── kernel.cl │ │ │ └── writezero_nobenign │ │ │ │ └── kernel.cl │ │ └── pass │ │ │ ├── readafterwrite │ │ │ └── kernel.cl │ │ │ ├── writeafterread │ │ │ └── kernel.cl │ │ │ ├── writeinloop │ │ │ └── kernel.cl │ │ │ ├── writetiddiv64 │ │ │ └── kernel.cl │ │ │ ├── writewritearray │ │ │ └── kernel.cl │ │ │ └── writezero │ │ │ └── kernel.cl │ ├── bitand │ │ └── kernel.cl │ ├── bitnot │ │ └── kernel.cl │ ├── bitor │ │ └── kernel.cl │ ├── bitxor │ │ └── kernel.cl │ ├── bool_bv_test │ │ └── kernel.cl │ ├── booleanTests │ │ └── kernel.cl │ ├── bpl_integration │ │ └── pass │ │ │ ├── axioms.bpl │ │ │ └── kernel.cl │ ├── break_test │ │ └── kernel.cl │ ├── casttofloat │ │ └── kernel.cl │ ├── ceil │ │ └── kernel.cl │ ├── checkarrays │ │ ├── fail │ │ │ ├── arraydoesnotexist1 │ │ │ │ └── kernel.cl │ │ │ └── arraydoesnotexist2 │ │ │ │ └── kernel.cl │ │ └── pass │ │ │ ├── specifyall │ │ │ └── kernel.cl │ │ │ └── specifyone │ │ │ └── kernel.cl │ ├── conditional_int_test │ │ └── kernel.cl │ ├── constantnotparam │ │ └── kernel.cl │ ├── derived_from_uniformity_analysis_bug │ │ └── kernel.cl │ ├── derivedfrombinomialoptions │ │ └── kernel.cl │ ├── derivedfrombinomialoptions2 │ │ └── kernel.cl │ ├── divergence │ │ ├── race_and_divergence │ │ │ └── kernel.cl │ │ └── race_no_divergence │ │ │ └── kernel.cl │ ├── enabled │ │ ├── dominator │ │ │ └── kernel.cl │ │ ├── not_predicated │ │ │ └── kernel.cl │ │ └── not_predicated_procedure │ │ │ └── kernel.cl │ ├── expression_simplification │ │ ├── and_test │ │ │ └── kernel.cl │ │ ├── basic_test │ │ │ └── kernel.cl │ │ ├── imp_antecedent │ │ │ └── kernel.cl │ │ ├── imp_bug │ │ │ └── kernel.cl │ │ ├── imp_consequent │ │ │ └── kernel.cl │ │ └── or_test │ │ │ └── kernel.cl │ ├── fail_bodiless_procedure │ │ └── kernel.cl │ ├── fail_equality_and_adversarial │ │ └── kernel.cl │ ├── float_constant_test │ │ └── kernel.cl │ ├── float_constant_test2 │ │ └── kernel.cl │ ├── floatcastrequired │ │ └── kernel.cl │ ├── floatrelationalop │ │ └── kernel.cl │ ├── fresh_arrays │ │ ├── fail │ │ │ └── global │ │ │ │ └── kernel.cl │ │ └── pass │ │ │ ├── global │ │ │ └── kernel.cl │ │ │ └── local │ │ │ └── kernel.cl │ ├── function_wide │ │ ├── fail │ │ │ ├── assert_false │ │ │ │ └── kernel.cl │ │ │ ├── not_at_end_for │ │ │ │ └── kernel.cl │ │ │ ├── not_at_end_if │ │ │ │ └── kernel.cl │ │ │ ├── uses_function │ │ │ │ └── kernel.cl │ │ │ └── uses_params │ │ │ │ └── kernel.cl │ │ └── pass │ │ │ ├── as_candidates │ │ │ └── kernel.cl │ │ │ ├── candidates │ │ │ └── kernel.cl │ │ │ ├── uses_array_element │ │ │ └── kernel.cl │ │ │ └── uses_uninterpreted_function │ │ │ └── kernel.cl │ ├── get_global_id │ │ └── kernel.cl │ ├── get_global_offset │ │ └── kernel.cl │ ├── get_work_dim │ │ ├── work_dim_1 │ │ │ └── kernel.cl │ │ ├── work_dim_2 │ │ │ └── kernel.cl │ │ └── work_dim_3 │ │ │ └── kernel.cl │ ├── global_size │ │ ├── local_size_fail_divide_global_size │ │ │ └── kernel.cl │ │ ├── mismatch_dims │ │ │ └── kernel.cl │ │ ├── num_groups_and_global_size │ │ │ └── kernel.cl │ │ └── simple │ │ │ └── kernel.cl │ ├── globalarray │ │ ├── fail │ │ │ └── kernel.cl │ │ ├── pass │ │ │ └── kernel.cl │ │ └── pass2 │ │ │ └── kernel.cl │ ├── imagetests │ │ ├── fail2dimagecopy │ │ │ └── kernel.cl │ │ ├── test2dimagecopy │ │ │ └── kernel.cl │ │ ├── testsampler │ │ │ └── kernel.cl │ │ ├── testsampler2 │ │ │ └── kernel.cl │ │ └── testsampler3 │ │ │ └── kernel.cl │ ├── induction_variable │ │ └── kernel.cl │ ├── inference_tests │ │ ├── access_means_enabled │ │ │ └── kernel.cl │ │ ├── disabled_invariant │ │ │ └── kernel.cl │ │ ├── enabled_invariant │ │ │ └── kernel.cl │ │ ├── lower_bound │ │ │ └── kernel.cl │ │ ├── strided_invariant │ │ │ └── kernel.cl │ │ └── strided_invariant_2 │ │ │ └── kernel.cl │ ├── inter_group_and_barrier_flag_tests │ │ ├── fail │ │ │ ├── bad_read_then_write │ │ │ │ └── kernel.cl │ │ │ ├── bad_write_then_read │ │ │ │ └── kernel.cl │ │ │ ├── local_id │ │ │ │ └── kernel.cl │ │ │ ├── missing_global_barrier_flag │ │ │ │ └── kernel.cl │ │ │ ├── missing_local_barrier_flag │ │ │ │ └── kernel.cl │ │ │ ├── no_barrier_flags │ │ │ │ └── kernel.cl │ │ │ ├── sync │ │ │ │ └── kernel.cl │ │ │ └── sync_within_group_wrong_flag │ │ │ │ └── kernel.cl │ │ └── pass │ │ │ ├── global_barrier │ │ │ └── kernel.cl │ │ │ ├── local_barrier_flag │ │ │ └── kernel.cl │ │ │ ├── local_id_benign_write_write │ │ │ └── kernel.cl │ │ │ ├── pass_due_to_intra_group_flag │ │ │ └── kernel.cl │ │ │ ├── read_then_write │ │ │ └── kernel.cl │ │ │ ├── sync_within_group │ │ │ └── kernel.cl │ │ │ └── write_then_read │ │ │ └── kernel.cl │ ├── k-induction │ │ ├── alldifferent-k-too-small │ │ │ └── kernel.cl │ │ ├── alldifferent │ │ │ └── kernel.cl │ │ └── amazingreduction │ │ │ └── kernel.cl │ ├── leftshiftequals │ │ └── kernel.cl │ ├── localarrayaccess │ │ └── kernel.cl │ ├── localmultidimarraydecl │ │ └── kernel.cl │ ├── mem_fence │ │ └── kernel.cl │ ├── misc │ │ ├── fail │ │ │ ├── 2d_array_race │ │ │ │ └── kernel.cl │ │ │ ├── 4d_array_of_structs_race │ │ │ │ └── kernel.cl │ │ │ ├── 4d_array_of_vectors_race │ │ │ │ └── kernel.cl │ │ │ ├── 4d_array_race │ │ │ │ └── kernel.cl │ │ │ ├── 4d_array_with_casting │ │ │ │ └── kernel.cl │ │ │ ├── loop_abstraction_traces_1 │ │ │ │ └── kernel.cl │ │ │ ├── loop_abstraction_traces_2 │ │ │ │ └── kernel.cl │ │ │ ├── miscfail1 │ │ │ │ └── kernel.cl │ │ │ ├── miscfail10 │ │ │ │ └── kernel.cl │ │ │ ├── miscfail11 │ │ │ │ └── kernel.cl │ │ │ ├── miscfail2 │ │ │ │ └── kernel.cl │ │ │ ├── miscfail3 │ │ │ │ └── kernel.cl │ │ │ ├── miscfail4 │ │ │ │ └── kernel.cl │ │ │ ├── miscfail5 │ │ │ │ └── kernel.cl │ │ │ ├── miscfail6 │ │ │ │ └── kernel.cl │ │ │ ├── miscfail7 │ │ │ │ └── kernel.cl │ │ │ ├── miscfail8 │ │ │ │ └── kernel.cl │ │ │ ├── miscfail9 │ │ │ │ └── kernel.cl │ │ │ ├── struct_member_race │ │ │ │ └── kernel.cl │ │ │ └── vector_element_race │ │ │ │ └── kernel.cl │ │ └── pass │ │ │ ├── misc1 │ │ │ └── kernel.cl │ │ │ ├── misc10 │ │ │ └── kernel.cl │ │ │ ├── misc11 │ │ │ └── kernel.cl │ │ │ ├── misc12 │ │ │ └── kernel.cl │ │ │ ├── misc13 │ │ │ └── kernel.cl │ │ │ ├── misc14 │ │ │ └── kernel.cl │ │ │ ├── misc15 │ │ │ └── kernel.cl │ │ │ ├── misc16 │ │ │ └── kernel.cl │ │ │ ├── misc17 │ │ │ └── kernel.cl │ │ │ ├── misc18 │ │ │ └── kernel.cl │ │ │ ├── misc19 │ │ │ └── kernel.cl │ │ │ ├── misc2 │ │ │ └── kernel.cl │ │ │ ├── misc3 │ │ │ └── kernel.cl │ │ │ ├── misc4 │ │ │ └── kernel.cl │ │ │ ├── misc5 │ │ │ └── kernel.cl │ │ │ ├── misc6 │ │ │ └── kernel.cl │ │ │ ├── misc7 │ │ │ └── kernel.cl │ │ │ ├── misc8 │ │ │ └── kernel.cl │ │ │ └── misc9 │ │ │ └── kernel.cl │ ├── modifyparam │ │ └── kernel.cl │ ├── multidimarrays │ │ ├── test1 │ │ │ └── kernel.cl │ │ ├── test2 │ │ │ └── kernel.cl │ │ ├── test3 │ │ │ └── kernel.cl │ │ ├── test4 │ │ │ └── kernel.cl │ │ └── test5 │ │ │ └── kernel.cl │ ├── multiplelocals │ │ └── kernel.cl │ ├── multiplelocals2 │ │ └── kernel.cl │ ├── no_log │ │ ├── fail │ │ │ └── kernel.cl │ │ └── pass │ │ │ └── kernel.cl │ ├── nonterminating │ │ └── kernel.cl │ ├── noraceduetoreturn │ │ └── kernel.cl │ ├── notunaryoptest │ │ └── kernel.cl │ ├── notunaryoptest2 │ │ └── kernel.cl │ ├── null_pointers │ │ ├── atomic_null │ │ │ └── kernel.cl │ │ ├── function_prototype │ │ │ └── kernel.cl │ │ ├── function_prototype_or_local │ │ │ └── kernel.cl │ │ ├── load_from_null │ │ │ └── kernel.cl │ │ ├── non_null_pointer_assignment │ │ │ └── kernel.cl │ │ ├── non_null_pointer_assignment_2 │ │ │ └── kernel.cl │ │ ├── null_pointer_assignment │ │ │ └── kernel.cl │ │ ├── null_pointer_assignment_equal │ │ │ └── kernel.cl │ │ ├── null_pointer_assignment_function │ │ │ └── kernel.cl │ │ ├── null_pointer_assignment_unequal │ │ │ └── kernel.cl │ │ ├── null_pointer_choice │ │ │ └── kernel.cl │ │ ├── null_pointer_greater │ │ │ └── kernel.cl │ │ ├── null_pointer_use_in_function │ │ │ └── kernel.cl │ │ ├── null_pointer_use_in_function_inline │ │ │ └── kernel.cl │ │ └── store_to_null_and_non_null │ │ │ └── kernel.cl │ ├── null_statement │ │ └── kernel.cl │ ├── pointeranalysistests │ │ ├── manyprocedures │ │ │ └── kernel.cl │ │ ├── manyproceduresinlined │ │ │ └── kernel.cl │ │ ├── testbasicaliasing │ │ │ └── kernel.cl │ │ ├── testbasicaliasing2 │ │ │ └── kernel.cl │ │ ├── testbasicpointerarithmetic │ │ │ └── kernel.cl │ │ ├── testbasicpointerarithmetic2 │ │ │ └── kernel.cl │ │ ├── testinterprocedural │ │ │ └── kernel.cl │ │ ├── testinterprocedural2 │ │ │ └── kernel.cl │ │ └── testinterprocedural_inlined │ │ │ └── kernel.cl │ ├── pointertests │ │ ├── param_addressof │ │ │ └── kernel.cl │ │ ├── pointerarith │ │ │ └── kernel.cl │ │ ├── test_copy_between_memory_spaces │ │ │ └── kernel.cl │ │ ├── test_copy_between_memory_spaces2 │ │ │ └── kernel.cl │ │ ├── test_dereference_address_of │ │ │ └── kernel.cl │ │ ├── test_derived_from_binomial_opts │ │ │ └── kernel.cl │ │ ├── test_opencl_local_array │ │ │ └── kernel.cl │ │ ├── test_opencl_local_param │ │ │ └── kernel.cl │ │ ├── test_pass_address_of_local │ │ │ └── kernel.cl │ │ ├── test_pass_value_from_array │ │ │ └── kernel.cl │ │ └── test_return_pointer │ │ │ └── kernel.cl │ ├── pow2 │ │ ├── 64bit_loopcounter │ │ │ └── kernel.cl │ │ └── 64bit_relational │ │ │ └── kernel.cl │ ├── predicated_undef │ │ └── kernel.cl │ ├── privatememoryaccess │ │ ├── privatearraytest │ │ │ └── kernel.cl │ │ ├── privatevariabletest │ │ │ └── kernel.cl │ │ └── privatevariabletest2 │ │ │ └── kernel.cl │ ├── reducedstrength_generalised │ │ └── kernel.cl │ ├── reducedstrengthnonloopbug │ │ └── kernel.cl │ ├── report_global_id │ │ ├── test1 │ │ │ └── kernel.cl │ │ └── test2 │ │ │ └── kernel.cl │ ├── return_tests │ │ ├── id_dependent_return │ │ │ └── kernel.cl │ │ ├── multiloop_return │ │ │ └── kernel.cl │ │ ├── multiloop_return_simplified │ │ │ └── kernel.cl │ │ └── simple_return │ │ │ └── kernel.cl │ ├── rightshiftequals │ │ └── kernel.cl │ ├── saturate │ │ ├── sadd │ │ │ └── kernel.cl │ │ ├── ssub │ │ │ └── kernel.cl │ │ ├── uadd │ │ │ └── kernel.cl │ │ └── usub │ │ │ └── kernel.cl │ ├── shared_int │ │ └── kernel.cl │ ├── shuffle │ │ ├── shuffle │ │ │ └── kernel.cl │ │ └── shuffle2 │ │ │ └── kernel.cl │ ├── simplebinomialoptions │ │ └── kernel.cl │ ├── simplebinomialoptions2 │ │ └── kernel.cl │ ├── simpleparampassing │ │ └── kernel.cl │ ├── simpleprocedurecall │ │ └── kernel.cl │ ├── simplereturn │ │ └── kernel.cl │ ├── skeletonbinomialoptions │ │ └── kernel.cl │ ├── sourcelocation_tests │ │ ├── assert │ │ │ └── kernel.cl │ │ ├── barrier_divergence │ │ │ ├── fail │ │ │ │ └── kernel.cl │ │ │ └── pass │ │ │ │ └── kernel.cl │ │ ├── ensures │ │ │ ├── fail │ │ │ │ └── kernel.cl │ │ │ └── pass │ │ │ │ └── kernel.cl │ │ ├── loop_invariant │ │ │ ├── fail │ │ │ │ ├── entry │ │ │ │ │ └── kernel.cl │ │ │ │ └── maintained │ │ │ │ │ └── kernel.cl │ │ │ └── pass │ │ │ │ └── kernel.cl │ │ ├── needs_source_location_ensures │ │ │ └── kernel.cl │ │ ├── needs_source_location_requires │ │ │ └── kernel.cl │ │ ├── race_from_bodiless_call │ │ │ └── kernel.cl │ │ ├── race_from_call │ │ │ └── kernel.cl │ │ ├── race_from_call_in_loop │ │ │ └── kernel.cl │ │ ├── race_with_loop │ │ │ └── kernel.cl │ │ ├── races │ │ │ ├── fail │ │ │ │ ├── read_write │ │ │ │ │ └── kernel.cl │ │ │ │ ├── write_read │ │ │ │ │ └── kernel.cl │ │ │ │ └── write_write │ │ │ │ │ ├── elem_width_16 │ │ │ │ │ └── kernel.cl │ │ │ │ │ ├── loop │ │ │ │ │ └── kernel.cl │ │ │ │ │ └── normal │ │ │ │ │ └── kernel.cl │ │ │ └── pass │ │ │ │ ├── no_race │ │ │ │ └── kernel.cl │ │ │ │ └── read_read │ │ │ │ └── kernel.cl │ │ ├── races_from_indirect_calls │ │ │ └── kernel.cl │ │ └── requires │ │ │ └── kernel.cl │ ├── ternarytest │ │ └── kernel.cl │ ├── ternarytest2 │ │ └── kernel.cl │ ├── test_2d_global_index_inference │ │ └── kernel.cl │ ├── test_2d_local_index_inference │ │ └── kernel.cl │ ├── test_2d_local_index_inference_2 │ │ └── kernel.cl │ ├── test_address_of_bug │ │ └── kernel.cl │ ├── test_binary_stmt │ │ └── kernel.cl │ ├── test_float_neq │ │ └── kernel.cl │ ├── test_for_benign_read_write_bug │ │ └── kernel.cl │ ├── test_for_get_group_id │ │ └── kernel.cl │ ├── test_for_ssa_bug │ │ └── kernel.cl │ ├── test_for_uniformity_bug │ │ └── kernel.cl │ ├── test_global_id_inference │ │ └── kernel.cl │ ├── test_inline │ │ └── kernel.cl │ ├── test_line_number_problem │ │ └── kernel.cl │ ├── test_local_id_inference │ │ └── kernel.cl │ ├── test_mod_invariants │ │ ├── global_direct │ │ │ └── kernel.cl │ │ ├── global_reduce_strength │ │ │ └── kernel.cl │ │ ├── local_direct │ │ │ └── kernel.cl │ │ └── local_reduce_strength │ │ │ └── kernel.cl │ ├── test_nooverflowing_add │ │ └── kernel.cl │ ├── test_nooverflowing_add_predicate │ │ └── kernel.cl │ ├── test_nooverflowing_add_signed │ │ └── kernel.cl │ ├── test_part_load_store │ │ ├── load_ptr_and_int │ │ │ └── kernel.cl │ │ ├── load_ptr_and_short2 │ │ │ └── kernel.cl │ │ ├── load_ptr_array_and_int │ │ │ └── kernel.cl │ │ ├── store_int_and_short │ │ │ └── kernel.cl │ │ ├── store_ptr_and_int │ │ │ └── kernel.cl │ │ ├── store_ptr_and_short │ │ │ └── kernel.cl │ │ ├── store_ptr_and_short2 │ │ │ └── kernel.cl │ │ └── store_ptr_array_and_int │ │ │ └── kernel.cl │ ├── test_relational_inference │ │ └── kernel.cl │ ├── test_structs │ │ ├── requires │ │ │ └── kernel.cl │ │ ├── requires_with_store │ │ │ └── kernel.cl │ │ ├── store_array_element │ │ │ └── kernel.cl │ │ ├── store_element │ │ │ └── kernel.cl │ │ ├── store_ptr_array_element │ │ │ └── kernel.cl │ │ ├── store_ptr_element │ │ │ └── kernel.cl │ │ ├── store_struct_element │ │ │ └── kernel.cl │ │ ├── use_array_element │ │ │ └── kernel.cl │ │ ├── use_element │ │ │ └── kernel.cl │ │ ├── use_ptr_array_element │ │ │ └── kernel.cl │ │ ├── use_ptr_element │ │ │ └── kernel.cl │ │ └── use_struct_element │ │ │ └── kernel.cl │ ├── transitiveclosuresimplified │ │ └── kernel.cl │ ├── transitiveclosuresimplified2 │ │ └── kernel.cl │ ├── typestest │ │ └── kernel.cl │ ├── unconstrained_sizes │ │ ├── global_size │ │ │ └── kernel.cl │ │ ├── local_size │ │ │ └── kernel.cl │ │ └── num_groups │ │ │ └── kernel.cl │ ├── undef_tests │ │ ├── uninitialised_local_int │ │ │ └── kernel.cl │ │ └── uninitialised_local_ptr │ │ │ └── kernel.cl │ ├── unreachable │ │ └── kernel.cl │ ├── unusedreturn │ │ └── kernel.cl │ ├── vectortests │ │ ├── addressofvector │ │ │ └── kernel.cl │ │ ├── double2arithmetic │ │ │ └── kernel.cl │ │ ├── double2simpleaccess │ │ │ └── kernel.cl │ │ ├── double4simpleaccess │ │ │ └── kernel.cl │ │ ├── double8simpleaccess │ │ │ └── kernel.cl │ │ ├── float16simpleaccess │ │ │ └── kernel.cl │ │ ├── float2simpleaccess │ │ │ └── kernel.cl │ │ ├── float4arithmetic │ │ │ └── kernel.cl │ │ ├── float4arrayaccess │ │ │ └── kernel.cl │ │ ├── float4initialisation │ │ │ └── kernel.cl │ │ ├── float4simpleaccess │ │ │ └── kernel.cl │ │ ├── float8simpleaccess │ │ │ └── kernel.cl │ │ ├── int2simpleaccess │ │ │ └── kernel.cl │ │ ├── int3arrayaccess │ │ │ └── kernel.cl │ │ ├── int3load │ │ │ └── kernel.cl │ │ ├── int3store │ │ │ └── kernel.cl │ │ ├── int4initialisation │ │ │ └── kernel.cl │ │ ├── int_vectors_big_test │ │ │ └── kernel.cl │ │ ├── select │ │ │ └── kernel.cl │ │ ├── test_mul_add │ │ │ └── kernel.cl │ │ ├── test_paren │ │ │ └── kernel.cl │ │ ├── vectorops │ │ │ └── kernel.cl │ │ ├── vectorops2 │ │ │ └── kernel.cl │ │ ├── vectorreturn │ │ │ └── kernel.cl │ │ ├── vectorsplat │ │ │ └── kernel.cl │ │ └── vectorswizzle │ │ │ └── kernel.cl │ └── warpsync │ │ ├── 2d │ │ └── kernel.cl │ │ ├── broken_shuffle │ │ └── kernel.cl │ │ ├── intragroup_scan │ │ └── kernel.cl │ │ ├── scan_warp │ │ └── kernel.cl │ │ └── shuffle │ │ └── kernel.cl ├── baseline.pickle └── misc │ ├── local_revision │ └── local_revision.misc │ └── version_info │ └── version_info.misc └── utils ├── GPUVerifyRise4Fun ├── README ├── SourceCodeSanitiser.py ├── clientutil.py ├── config.py.template ├── cuda │ ├── __init__.py │ ├── samples │ │ ├── OOPSLA2014-transpose.cu │ │ ├── add_neighbour_bug.cu │ │ ├── add_neighbour_correct.cu │ │ ├── in_loop_barrier_divergence.cu │ │ ├── reduction_bug.cu │ │ ├── reduction_correct.cu │ │ └── simple_barrier_divergence.cu │ └── syntax.py ├── gvapi.py ├── meta_data.py ├── observers │ ├── __init__.py │ ├── example.py │ ├── kernelcounter.py │ └── kernelrecorder.py ├── opencl │ ├── __init__.py │ ├── samples │ │ ├── add_neighbour_bug.cl │ │ ├── add_neighbour_correct.cl │ │ ├── in_loop_barrier_divergence.cl │ │ ├── reduction_bug.cl │ │ ├── reduction_correct.cl │ │ └── simple_barrier_divergence.cl │ ├── syntax.py │ └── tutorials │ │ └── tutorial_1 │ │ ├── kernel1.cl │ │ └── test.md ├── print-counters.py ├── production_server.py ├── service │ └── upstart-job.conf ├── simpleclient.py ├── static │ ├── imperial-college-logo.png │ ├── privacy-policy.html │ └── terms-of-use.html ├── tester.py └── webservice.py └── check_json.py /.github/workflows/build_and_install_libclc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ev 3 | 4 | cd ${LLVM_PROJECT_DIR}/libclc 5 | $PYTHON ./configure.py -g ninja --with-llvm-config=${LLVM_CONFIG} \ 6 | --with-cxx-compiler=${CXX} --prefix=${LIBCLC_INSTALL_DIR} \ 7 | nvptx-- nvptx64-- 8 | ninja install 9 | -------------------------------------------------------------------------------- /.github/workflows/build_bugle.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ev 3 | 4 | cd ${BUGLE_DIR} 5 | mkdir build && cd build 6 | cmake -G Ninja -DLLVM_CONFIG_EXECUTABLE=`which ${LLVM_CONFIG}` \ 7 | -DCMAKE_BUILD_TYPE=Release .. 8 | ninja 9 | -------------------------------------------------------------------------------- /.github/workflows/build_gpuverify.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ev 3 | 4 | cd ${GPUVERIFY_DIR} 5 | nuget restore GPUVerify.sln 6 | msbuild /m /p:Configuration=Release \ 7 | /p:CodeAnalysisRuleSet=$PWD/StyleCop.ruleset GPUVerify.sln 8 | -------------------------------------------------------------------------------- /.github/workflows/download_and_symlink_cvc4.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ev 3 | 4 | wget -c https://github.com/cvc5/cvc5/releases/download/${CVC4_VERSION}/${CVC4} 5 | chmod u+x ${CVC4} 6 | ln -s ${CVC4} cvc4.exe 7 | -------------------------------------------------------------------------------- /.github/workflows/download_and_symlink_z3.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ev 3 | 4 | wget -c \ 5 | https://github.com/Z3Prover/z3/releases/download/z3-${Z3_VERSION}/${Z3}.zip 6 | unzip ${Z3}.zip 7 | ln -s ${Z3}/bin/z3 z3.exe 8 | -------------------------------------------------------------------------------- /.github/workflows/symlink_llvm_tools.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ev 3 | 4 | cd ${BUILD_ROOT} 5 | ln -s `which clang-${LLVM_VERSION}` clang 6 | ln -s `which opt-${LLVM_VERSION}` opt 7 | ln -s `which llvm-nm-${LLVM_VERSION}` llvm-nm 8 | -------------------------------------------------------------------------------- /.github/workflows/test_gpuverify.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ev 3 | 4 | cd ${GPUVERIFY_DIR} 5 | $PYTHON ./gvtester.py --write-pickle run.pickle testsuite 6 | $PYTHON ./gvtester.py --compare-pickle testsuite/baseline.pickle run.pickle 7 | -------------------------------------------------------------------------------- /BoogieBinaries/BoogieAbsInt.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mc-imperial/gpuverify/49219770aad01231edd0d8e0fa3ed036006cf32a/BoogieBinaries/BoogieAbsInt.dll -------------------------------------------------------------------------------- /BoogieBinaries/BoogieBasetypes.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mc-imperial/gpuverify/49219770aad01231edd0d8e0fa3ed036006cf32a/BoogieBinaries/BoogieBasetypes.dll -------------------------------------------------------------------------------- /BoogieBinaries/BoogieCodeContractsExtender.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mc-imperial/gpuverify/49219770aad01231edd0d8e0fa3ed036006cf32a/BoogieBinaries/BoogieCodeContractsExtender.dll -------------------------------------------------------------------------------- /BoogieBinaries/BoogieConcurrency.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mc-imperial/gpuverify/49219770aad01231edd0d8e0fa3ed036006cf32a/BoogieBinaries/BoogieConcurrency.dll -------------------------------------------------------------------------------- /BoogieBinaries/BoogieCore.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mc-imperial/gpuverify/49219770aad01231edd0d8e0fa3ed036006cf32a/BoogieBinaries/BoogieCore.dll -------------------------------------------------------------------------------- /BoogieBinaries/BoogieDoomed.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mc-imperial/gpuverify/49219770aad01231edd0d8e0fa3ed036006cf32a/BoogieBinaries/BoogieDoomed.dll -------------------------------------------------------------------------------- /BoogieBinaries/BoogieExecutionEngine.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mc-imperial/gpuverify/49219770aad01231edd0d8e0fa3ed036006cf32a/BoogieBinaries/BoogieExecutionEngine.dll -------------------------------------------------------------------------------- /BoogieBinaries/BoogieGraph.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mc-imperial/gpuverify/49219770aad01231edd0d8e0fa3ed036006cf32a/BoogieBinaries/BoogieGraph.dll -------------------------------------------------------------------------------- /BoogieBinaries/BoogieHoudini.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mc-imperial/gpuverify/49219770aad01231edd0d8e0fa3ed036006cf32a/BoogieBinaries/BoogieHoudini.dll -------------------------------------------------------------------------------- /BoogieBinaries/BoogieModel.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mc-imperial/gpuverify/49219770aad01231edd0d8e0fa3ed036006cf32a/BoogieBinaries/BoogieModel.dll -------------------------------------------------------------------------------- /BoogieBinaries/BoogieParserHelper.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mc-imperial/gpuverify/49219770aad01231edd0d8e0fa3ed036006cf32a/BoogieBinaries/BoogieParserHelper.dll -------------------------------------------------------------------------------- /BoogieBinaries/BoogieVCExpr.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mc-imperial/gpuverify/49219770aad01231edd0d8e0fa3ed036006cf32a/BoogieBinaries/BoogieVCExpr.dll -------------------------------------------------------------------------------- /BoogieBinaries/BoogieVCGeneration.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mc-imperial/gpuverify/49219770aad01231edd0d8e0fa3ed036006cf32a/BoogieBinaries/BoogieVCGeneration.dll -------------------------------------------------------------------------------- /BoogieBinaries/Provers.SMTLib.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mc-imperial/gpuverify/49219770aad01231edd0d8e0fa3ed036006cf32a/BoogieBinaries/Provers.SMTLib.dll -------------------------------------------------------------------------------- /Documentation/examples/add-neighbour-buggy-error.txt: -------------------------------------------------------------------------------- 1 | add-neighbour-buggy.cl: error: possible read-write race on ((char*)A)[32]: 2 | 3 | add-neighbour-buggy.cl:3:3: write by thread (8, 0, 0) group (0, 0, 0) 4 | A[tid] += A[tid + offset]; 5 | 6 | add-neighbour-buggy.cl:3:3: read by thread (4, 0, 0) group (0, 0, 0) 7 | A[tid] += A[tid + offset]; 8 | 9 | -------------------------------------------------------------------------------- /Documentation/examples/add-neighbour-buggy.cl: -------------------------------------------------------------------------------- 1 | __kernel void add_neighbour(__local int *A, int offset) { 2 | int tid = get_local_id(0); 3 | A[tid] += A[tid + offset]; 4 | } -------------------------------------------------------------------------------- /Documentation/examples/add-neighbour-correct-output.txt: -------------------------------------------------------------------------------- 1 | Verified: add-neighbour-correct.cl 2 | - no data races within work groups 3 | - no data races between work groups 4 | - no barrier divergence 5 | - no assertion failures 6 | (but absolutely no warranty provided) 7 | -------------------------------------------------------------------------------- /Documentation/examples/add-neighbour-correct.cl: -------------------------------------------------------------------------------- 1 | __kernel void add_neighbour(__local int *A, int offset) { 2 | int tid = get_local_id(0); 3 | int temp = A[tid + offset]; 4 | barrier(CLK_LOCAL_MEM_FENCE); 5 | A[tid] += temp; 6 | } -------------------------------------------------------------------------------- /Documentation/examples/assert-as-invariant-error.txt: -------------------------------------------------------------------------------- 1 | assert-as-invariant.cl:4:5: error: loop invariant might not be maintained by the loop for thread (102, 0, 0) group (8, 0, 0) 2 | __assert(i <= 100) // Assertion at loop head treated as invariant 3 | assert-as-invariant.cl:4:5: error: loop invariant might not be maintained by the loop for thread (101, 0, 0) group (0, 0, 0) 4 | __assert(i <= 100) // Assertion at loop head treated as invariant 5 | 6 | -------------------------------------------------------------------------------- /Documentation/examples/assert-as-invariant.cl: -------------------------------------------------------------------------------- 1 | __kernel void foo() { 2 | int i = 0; 3 | while( 4 | __assert(i <= 100) // Assertion at loop head treated as invariant 5 | , // Comma operator separates invariant from loop guard 6 | i < get_local_id(0) // This is the loop guard 7 | ) { 8 | i++; 9 | } 10 | } -------------------------------------------------------------------------------- /Documentation/examples/barrier-div-cuda-error.txt: -------------------------------------------------------------------------------- 1 | barrier-div-cuda.cu:6:5: error: barrier may be reached by non-uniform control flow 2 | __syncthreads(); 3 | -------------------------------------------------------------------------------- /Documentation/examples/barrier-div-cuda.cu: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | __global__ void foo(int *p) { 4 | if(p[threadIdx.x]) { 5 | // May be reached by some threads but not others depending on contents of p 6 | __syncthreads(); 7 | } 8 | } -------------------------------------------------------------------------------- /Documentation/examples/barrier-div-opencl-error.txt: -------------------------------------------------------------------------------- 1 | barrier-div.cl:4:5: error: barrier may be reached by non-uniform control flow 2 | barrier(CLK_GLOBAL_MEM_FENCE); 3 | -------------------------------------------------------------------------------- /Documentation/examples/barrier-div-opencl.cl: -------------------------------------------------------------------------------- 1 | __kernel void foo(__global int *p) { 2 | for(int i = 0; i < get_global_id(0); i++) { 3 | p[i + get_global_id(0)] = get_global_id(0); 4 | barrier(CLK_GLOBAL_MEM_FENCE); 5 | } 6 | } -------------------------------------------------------------------------------- /Documentation/examples/failing-assert-error.txt: -------------------------------------------------------------------------------- 1 | failing-assert.cu:4:3: error: this assertion might not hold for thread (5, 0, 0) group (22, 0, 0) 2 | __assert(threadIdx.x + blockIdx.x != 27); 3 | failing-assert.cu:4:3: error: this assertion might not hold for thread (16, 0, 0) group (11, 0, 0) 4 | __assert(threadIdx.x + blockIdx.x != 27); 5 | 6 | -------------------------------------------------------------------------------- /Documentation/examples/failing-assert.cu: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | __global__ void foo() { 4 | __assert(threadIdx.x + blockIdx.x != 27); 5 | } -------------------------------------------------------------------------------- /Documentation/examples/inter-group-error.txt: -------------------------------------------------------------------------------- 1 | inter-group.cu: error: possible write-write race on ((char*)p)[0]: 2 | 3 | inter-group.cu:4:3: write by thread (0, 0, 0) group (0, 0, 0) 4 | p[threadIdx.x] = threadIdx.x; 5 | 6 | inter-group.cu:4:3: write by thread (0, 0, 0) group (1, 0, 0) 7 | p[threadIdx.x] = threadIdx.x; 8 | -------------------------------------------------------------------------------- /Documentation/examples/inter-group.cu: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | __global__ void foo(int *p) { 4 | p[threadIdx.x] = threadIdx.x; 5 | } 6 | -------------------------------------------------------------------------------- /Documentation/examples/intra-group-error.txt: -------------------------------------------------------------------------------- 1 | intra-group.cl: error: possible write-write race on ((char*)p)[4092]: 2 | 3 | intra-group.cl:3:23: write by thread (0, 0, 0) group (0, 0, 0) 4 | p[get_local_id(0) + get_local_size(0) - 1] = get_local_id(0); 5 | 6 | intra-group.cl:2:5: write by thread (1023, 0, 0) group (0, 0, 0) 7 | p[get_local_id(0)] = get_local_id(0); 8 | -------------------------------------------------------------------------------- /Documentation/examples/intra-group.cl: -------------------------------------------------------------------------------- 1 | __kernel void foo(__global int *p) { 2 | p[get_local_id(0)] = get_local_id(0); 3 | p[get_local_id(0) + get_local_size(0) - 1] = get_local_id(0); 4 | } 5 | -------------------------------------------------------------------------------- /Documentation/examples/invariant-do-while-loop.cl: -------------------------------------------------------------------------------- 1 | __kernel void foo() { 2 | int j = get_local_id(0) - 1; 3 | int i = get_local_id(0); 4 | do { 5 | __invariant(i < 200); // First invariant 6 | __assert(i >= 0); // Second invariant 7 | __invariant(j == i - 1); // Third invariant 8 | i--; 9 | j--; 10 | } while(i > 0); 11 | } -------------------------------------------------------------------------------- /Documentation/examples/invariant-for-loop-error.txt: -------------------------------------------------------------------------------- 1 | invariant-for-loop.cl:4:7: error: loop invariant might not hold on entry for thread (512, 0, 0) group (0, 0, 0) 2 | __invariant(i < 200), // First invariant 3 | invariant-for-loop.cl:4:7: error: loop invariant might not hold on entry for thread (576, 0, 0) group (8, 0, 0) 4 | __invariant(i < 200), // First invariant 5 | 6 | -------------------------------------------------------------------------------- /Documentation/examples/invariant-for-loop.cl: -------------------------------------------------------------------------------- 1 | __kernel void foo() { 2 | int j = get_local_id(0) - 1; 3 | for(int i = get_local_id(0); 4 | __invariant(i < 200), // First invariant 5 | __assert(i >= 0), // Second invariant 6 | __invariant(j == i - 1), // Third invariant 7 | i > 0; // Loop guard 8 | i-- 9 | ) { 10 | j--; 11 | } 12 | } -------------------------------------------------------------------------------- /Documentation/examples/invariant-goto-loop.cl: -------------------------------------------------------------------------------- 1 | __kernel void foo() { 2 | int j = get_local_id(0) - 1; 3 | int i = get_local_id(0); 4 | head: 5 | __invariant(i < 200); // First invariant 6 | __assert(i >= 0); // Second invariant 7 | __invariant(j == i - 1); // Third invariant 8 | i--; 9 | j--; 10 | if(i > 0) goto head; 11 | } -------------------------------------------------------------------------------- /Documentation/examples/needs-requires.cu: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | __global__ void foo(float *A, int sz) { 4 | for(int i = 0; i < 100; i++) { 5 | A[sz*i + threadIdx.x] *= 2.0f; 6 | } 7 | } -------------------------------------------------------------------------------- /Documentation/examples/with-requires.cu: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | __global__ void foo(float *A, int sz) { 4 | __requires(sz == blockDim.x); 5 | for(int i = 0; i < 100; i++) { 6 | A[sz*i + threadIdx.x] *= 2.0f; 7 | } 8 | } -------------------------------------------------------------------------------- /Documentation/overview.rst: -------------------------------------------------------------------------------- 1 | Overview of GPUVerify 2 | ===================================== 3 | 4 | GPUVerify is a tool for analysing graphics processing unit (GPU) kernels written in OpenCL and CUDA. 5 | 6 | GPUVerify is a *static analysis* tool, that is it works purely at 7 | compile time, without actually running the GPU kernel. 8 | -------------------------------------------------------------------------------- /GPUVerify.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | python3 "%~dp0GPUVerify.py" %* 4 | -------------------------------------------------------------------------------- /GPUVerifyBoogieDriver/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /GPUVerifyCruncher/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /GPUVerifyLib/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /GPUVerifyScript/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mc-imperial/gpuverify/49219770aad01231edd0d8e0fa3ed036006cf32a/GPUVerifyScript/__init__.py -------------------------------------------------------------------------------- /GPUVerifyScript/constants.py: -------------------------------------------------------------------------------- 1 | """Module defining script-side constants""" 2 | 3 | class AnalysisMode(object): 4 | """ ALL is the default mode. Right now it is the same as VERIFY, but in 5 | the future this mode will run verification and bug-finding in parallel. 6 | """ 7 | ALL = 0 8 | FINDBUGS = 1 9 | VERIFY = 2 10 | 11 | class SourceLanguage(object): 12 | Unknown = 0 13 | OpenCL = 1 14 | CUDA = 2 15 | -------------------------------------------------------------------------------- /GPUVerifyVCGen/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /gpuverify: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | python3 $(dirname $0)/GPUVerify.py $@ 4 | 5 | -------------------------------------------------------------------------------- /license_banner.txt: -------------------------------------------------------------------------------- 1 | //===-----------------------------------------------------------------------==// 2 | // 3 | // GPUVerify - a Verifier for GPU Kernels 4 | // 5 | // This file is distributed under the Microsoft Public License. See 6 | // LICENSE.TXT for details. 7 | // 8 | //===----------------------------------------------------------------------===// 9 | 10 | 11 | -------------------------------------------------------------------------------- /testsuite/CUDA/align/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=2 --gridDim=2 --no-inline 3 | 4 | #include 5 | 6 | typedef struct __align__(64) { 7 | unsigned int tid, bid; 8 | } pair; 9 | 10 | __global__ void align_test (pair* A) 11 | { 12 | int tid = threadIdx.x; 13 | int bid = blockIdx.x; 14 | 15 | int idx = blockDim.x * bid + tid; 16 | 17 | A[idx].tid = tid; 18 | A[idx].bid = bid; 19 | } 20 | -------------------------------------------------------------------------------- /testsuite/CUDA/always_inline/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include 5 | 6 | __device__ int bar() __attribute__((always_inline)); 7 | 8 | __device__ int bar() 9 | { 10 | return 5; 11 | } 12 | 13 | __global__ void foo() 14 | { 15 | int x = bar(); 16 | __assert(x == 5); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/CUDA/annotation_tests/test_all/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include 5 | 6 | __global__ void foo(int* A) 7 | { 8 | 9 | __assert(__all(threadIdx.x < blockDim.x)); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/CUDA/annotation_tests/test_assert/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include 5 | 6 | __device__ void bar(int x) 7 | { 8 | __requires(__implies(__enabled(), x < 100)); 9 | } 10 | 11 | 12 | __global__ void foo(int y) 13 | { 14 | __assume(y < 100); 15 | 16 | __assert(y < 200); 17 | 18 | bar(y); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /testsuite/CUDA/annotation_tests/test_assume/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include 5 | 6 | __device__ void bar(int x) 7 | { 8 | __requires(__implies(__enabled(), x < 100)); 9 | } 10 | 11 | 12 | __global__ void foo(int y) 13 | { 14 | __assume(y < 100); 15 | 16 | bar(y); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/CUDA/annotation_tests/test_at_most_one/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=1 --no-inline 3 | 4 | #include 5 | 6 | 7 | __global__ void foo( int* A) 8 | { 9 | 10 | __assert(__implies(threadIdx.x == 4, __other_int(threadIdx.x) != 4)); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/CUDA/annotation_tests/test_axiom/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=[64,64] --gridDim=64 --no-inline 3 | 4 | #include 5 | 6 | __axiom(blockIdx.x == 16); 7 | 8 | __axiom(blockIdx.y == 16); 9 | 10 | __global__ void foo(int* A) { 11 | 12 | // Only race free because of axioms 13 | if(blockIdx.x != 16 || blockIdx.y != 16) { 14 | A[0] = threadIdx.x; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/CUDA/annotation_tests/test_contract/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include 5 | 6 | __device__ void bar() 7 | { 8 | __requires(__implies(__enabled(), threadIdx.x == 3)); 9 | } 10 | 11 | __global__ void foo() 12 | { 13 | if(threadIdx.x == 3) 14 | { 15 | bar(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/CUDA/annotation_tests/test_distinct/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=1 --no-inline 3 | 4 | #include 5 | 6 | 7 | __global__ void foo() 8 | { 9 | 10 | for(int i = threadIdx.x; 11 | __invariant(__implies(__enabled() & __uniform_bool(__enabled()), __distinct_int(i))), 12 | i < 100; i++) 13 | { 14 | 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/CUDA/annotation_tests/test_enabled_and_uniform/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include 5 | 6 | __global__ void foo() 7 | { 8 | for(int k = 0; 9 | __invariant(__uniform_int(k)), 10 | __invariant(__uniform_bool(__enabled())), 11 | k < 1000; k++) 12 | { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/CUDA/annotation_tests/test_for_loop_invariant/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include 5 | 6 | __global__ void foo() { 7 | 8 | for(int d = 1; __invariant(d == 1 | d == 2 | d == 4 | d == 8 | d == 16 | d == 32 | d == 64), d < 64; d <<= 1) { 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/CUDA/annotation_tests/test_no_readwrite/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | __global__ void foo(int *x) { 7 | for (int i=0; 8 | __invariant(__no_read(x)), 9 | __invariant(__no_write(x)), 10 | i<16; i++) { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/CUDA/annotation_tests/test_norace/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include 5 | 6 | __global__ void foo(int *x) { 7 | 8 | int d = 0; 9 | while(__invariant(__no_read(x)), d < 16) { 10 | d++; 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/CUDA/annotation_tests/test_requires/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include 5 | 6 | __device__ void bar(int x) { 7 | __requires(__implies(__enabled(), x > 0)); 8 | 9 | } 10 | 11 | __global__ void foo() { 12 | 13 | int d = 1; 14 | 15 | while(__invariant(d == 1 | d == 2 | d == 4 | d == 8 | d == 16 | d == 32 | d == 64), d < 64) { 16 | bar(d); 17 | d <<= 1; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /testsuite/CUDA/annotation_tests/test_while_loop_invariant/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=[64,64,64] --gridDim=[64,64] --no-inline 3 | 4 | #include 5 | 6 | __global__ void foo() { 7 | 8 | int d = 1; 9 | 10 | while( 11 | __invariant(__implies(__enabled(), d == 1 | d == 2 | d == 4 | d == 8 | d == 16 | d == 32 | d == 64)), 12 | __invariant(d > 0), 13 | d < 64) { 14 | d <<= 1; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/CUDA/argument_promotion/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=256 --gridDim=128 3 | 4 | texture texDKey128; 5 | 6 | __global__ void foo() 7 | { 8 | tex1Dfetch(texDKey128, 4); 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/CUDA/atomics/add_one/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=2 --gridDim=1 --no-inline 3 | 4 | #include 5 | 6 | __global__ void race_test (unsigned int* i, int* A) 7 | { 8 | int tid = threadIdx.x; 9 | int j = atomicAdd(i,1); 10 | A[j] = tid; 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/CUDA/atomics/add_tid/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--blockDim=2 --gridDim=1 --no-inline 3 | 4 | #include 5 | 6 | __global__ void race_test (unsigned int* i, int* A) 7 | { 8 | int tid = threadIdx.x; 9 | int j = atomicAdd(i,tid); 10 | A[j] = tid; 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/CUDA/atomics/add_zero/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--blockDim=2 --gridDim=1 --no-inline 3 | 4 | #include 5 | 6 | __global__ void race_test (unsigned int* i, int* A) 7 | { 8 | int tid = threadIdx.x; 9 | int j = atomicAdd(i,0); 10 | A[j] = tid; 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/CUDA/atomics/device_global/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--gridDim=1 --blockDim=2 --only-divergence 3 | 4 | __device__ unsigned int x = 0; 5 | 6 | __global__ void f() 7 | { 8 | atomicInc(&x, 1); 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/CUDA/atomics/pointer_add/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--gridDim=2 --blockDim=1024 3 | 4 | char *buffer; 5 | 6 | __global__ void atomicTest(int B) 7 | { 8 | atomicAdd((unsigned int *)&buffer, B); 9 | } 10 | 11 | -------------------------------------------------------------------------------- /testsuite/CUDA/atomics/test_abstraction_enforced/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--blockDim=2 --gridDim=1 3 | //assert 4 | 5 | __global__ void f(int *c) { 6 | 7 | if(threadIdx.x == 0) { 8 | *c = 0; 9 | atomicAdd(c, 1); 10 | int x = *c; 11 | int y = *c; 12 | __assert(x == 0); 13 | __assert(y == 0); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /testsuite/CUDA/barrierconditionalkernelparam/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | __global__ void foo(int x) { 7 | if (x == 0) { 8 | __syncthreads (); 9 | } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /testsuite/CUDA/basic1/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | __global__ void foo() { 7 | int a, b, c; 8 | a = 2; 9 | b = 3; 10 | c = a + b; 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/CUDA/basicbarrier/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | __global__ void foo() { 7 | int a, b, c; 8 | a = 2; 9 | b = 3; 10 | c = a + b; 11 | __syncthreads (); 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/CUDA/basicglobalarray/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=1 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | 7 | __global__ void foo(int* p) { 8 | p[threadIdx.x] = 2; 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/CUDA/casttofloat/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | __global__ void foo() { 7 | 8 | float x = (float)2; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/CUDA/cooperative_groups/fail/race/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--blockDim=32 --gridDim=2 3 | 4 | #include 5 | 6 | __global__ void race (int* A) 7 | { 8 | int tid = threadIdx.x; 9 | int bid = blockIdx.x; 10 | 11 | int idx = blockDim.x * bid + tid; 12 | 13 | int temp = A[idx + 1]; 14 | A[idx] = temp; 15 | } 16 | -------------------------------------------------------------------------------- /testsuite/CUDA/cooperative_groups/pass/block_barrier/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=32 --gridDim=1 3 | 4 | #include 5 | 6 | using namespace cooperative_groups; 7 | 8 | __global__ void race (int* A) 9 | { 10 | int tid = threadIdx.x; 11 | int bid = blockIdx.x; 12 | 13 | thread_block t = this_thread_block(); 14 | int idx = blockDim.x * bid + tid; 15 | 16 | int temp = A[idx + 1]; 17 | synchronize(t); 18 | A[idx] = temp; 19 | } 20 | -------------------------------------------------------------------------------- /testsuite/CUDA/cooperative_groups/pass/grid_barrier/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=32 --gridDim=2 3 | 4 | #include 5 | 6 | using namespace cooperative_groups; 7 | 8 | __global__ void race (int* A) 9 | { 10 | int tid = threadIdx.x; 11 | int bid = blockIdx.x; 12 | 13 | grid_group g = this_grid(); 14 | int idx = blockDim.x * bid + tid; 15 | 16 | int temp = A[idx + 1]; 17 | synchronize(g); 18 | A[idx] = temp; 19 | } 20 | -------------------------------------------------------------------------------- /testsuite/CUDA/cuda_arch/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=2048 --gridDim=64 3 | 4 | #if __CUDA_ARCH__ < 350 5 | #error Unexpected __CUDA_ARCH__ 6 | #endif 7 | 8 | __global__ void foo() { 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/CUDA/curand_tests/fail/curand_mtgp32_block_race/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--blockDim=256 --gridDim=2 --no-inline 3 | //Write by thread [\d]+ in thread block [\d]+ \(global id [\d]+\), .+kernel\.cu:9:21: 4 | 5 | #include 6 | 7 | __global__ void curand_test(curandStateMtgp32_t *state, float *A) { 8 | if (threadIdx.x == 0) { 9 | A[blockIdx.x] = curand(state); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/CUDA/curand_tests/fail/curand_mtgp32_race/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--blockDim=512 --gridDim=1 --no-inline 3 | //Write by thread .+kernel\.cu:8:21: 4 | 5 | #include 6 | 7 | __global__ void curand_test(curandStateMtgp32_t *state, float *A) { 8 | A[threadIdx.x] = curand(state); 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/CUDA/curand_tests/fail/curand_race/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--blockDim=2 --gridDim=1 --no-inline 3 | //Write by thread .+kernel\.cu:8:21: 4 | 5 | #include 6 | 7 | __global__ void curand_test(curandState *state, float *A) { 8 | A[threadIdx.x] = curand_uniform(state); 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/CUDA/curand_tests/fail/init_race/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--blockDim=2 --gridDim=1 --no-inline 3 | //Write by thread .+kernel.cu:8:4: 4 | 5 | #include 6 | 7 | __global__ void init_test(curandState *state, unsigned int *A) { 8 | curand_init(0, 0, 0, state); 9 | 10 | __syncthreads(); 11 | 12 | if (threadIdx.x == 0) { 13 | A[0] = curand(state); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /testsuite/CUDA/curand_tests/pass/curand/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=512 --gridDim=1 --no-inline 3 | 4 | #include 5 | 6 | __global__ void curand_test(curandState *state, float *A) { 7 | A[threadIdx.x] = curand(&state[threadIdx.x]); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/CUDA/curand_tests/pass/curand_mtgp32/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=256 --gridDim=1 --no-inline 3 | 4 | #include 5 | 6 | __global__ void curand_test(curandStateMtgp32_t *state, float *A) { 7 | A[threadIdx.x] = curand(state); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/CUDA/fail_tests/race_on_shared/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--blockDim=16 --gridDim=1 --no-inline 3 | // 4 | 5 | 6 | #include 7 | 8 | 9 | __global__ void foo() 10 | { 11 | __shared__ int A[16]; 12 | 13 | A[0] = threadIdx.x; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /testsuite/CUDA/fail_tests/shared_int/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | // 4 | 5 | 6 | #include "cuda.h" 7 | 8 | __global__ void foo() { 9 | 10 | __shared__ int a; 11 | 12 | a = threadIdx.x; 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/CUDA/floatcastrequired/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | __global__ void foo() { 7 | 8 | float x = __exp10f(2); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/CUDA/floatrelationalop/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | __global__ void foo() { 7 | 8 | float x = 2.0f; 9 | float y = 2.0f; 10 | 11 | if(x < y) { 12 | 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /testsuite/CUDA/fresh_arrays/fail/array/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--blockDim=2048 --gridDim=64 3 | //possible write-write race on q.p\[4\]\[0\] 4 | 5 | struct s { 6 | float *p[42]; 7 | }; 8 | 9 | __global__ void foo(s q) { 10 | __requires_fresh_array(q.p[4]); 11 | q.p[4][0] = threadIdx.x; 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/CUDA/fresh_arrays/fail/inherit/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--blockDim=2048 --gridDim=64 3 | //possible write-write race on q.p\[0\] 4 | 5 | struct s { 6 | float *p; 7 | }; 8 | 9 | struct t : s { 10 | }; 11 | 12 | __global__ void foo(t q) { 13 | __requires_fresh_array(q.p); 14 | q.p[0] = threadIdx.x; 15 | } 16 | -------------------------------------------------------------------------------- /testsuite/CUDA/fresh_arrays/fail/struct_char/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--blockDim=2048 --gridDim=64 3 | //possible write-write race on q.p\[0\] 4 | 5 | struct s { 6 | char *p; 7 | }; 8 | 9 | __global__ void foo(s q) { 10 | __requires_fresh_array(q.p); 11 | q.p[0] = threadIdx.x; 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/CUDA/fresh_arrays/fail/struct_float/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--blockDim=2048 --gridDim=64 3 | //possible write-write race on q.p\[0\] 4 | 5 | struct s { 6 | float *p; 7 | }; 8 | 9 | __global__ void foo(s q) { 10 | __requires_fresh_array(q.p); 11 | q.p[0] = threadIdx.x; 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/CUDA/fresh_arrays/fail/struct_nested/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--blockDim=2048 --gridDim=64 3 | //possible write-write race on q.v.p\[0\] 4 | 5 | struct s { 6 | float *p; 7 | }; 8 | 9 | struct t { 10 | s v; 11 | }; 12 | 13 | __global__ void foo(t q) { 14 | __requires_fresh_array(q.v.p); 15 | q.v.p[0] = threadIdx.x; 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/CUDA/fresh_arrays/pass/array/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=2048 --gridDim=64 3 | 4 | struct s { 5 | float *p[42]; 6 | }; 7 | 8 | __global__ void foo(s q) { 9 | __requires_fresh_array(q.p[4]); 10 | q.p[4][threadIdx.x + blockIdx.x * blockDim.x] = 4.2f; 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/CUDA/fresh_arrays/pass/inherit/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=2048 --gridDim=64 3 | 4 | struct s { 5 | float *p; 6 | }; 7 | 8 | struct t : s { 9 | }; 10 | 11 | __global__ void foo(t q) { 12 | __requires_fresh_array(q.p); 13 | q.p[threadIdx.x + blockIdx.x * blockDim.x] = 4.2f; 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/CUDA/fresh_arrays/pass/struct_char/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=2048 --gridDim=64 3 | 4 | struct s { 5 | char *p; 6 | }; 7 | 8 | __global__ void foo(s q) { 9 | __requires_fresh_array(q.p); 10 | q.p[threadIdx.x + blockIdx.x * blockDim.x] = 42; 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/CUDA/fresh_arrays/pass/struct_float/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=2048 --gridDim=64 3 | 4 | struct s { 5 | float *p; 6 | }; 7 | 8 | __global__ void foo(s q) { 9 | __requires_fresh_array(q.p); 10 | q.p[threadIdx.x + blockIdx.x * blockDim.x] = 4.2f; 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/CUDA/function_pointers/funcptr_to_ptr/axioms.bpl: -------------------------------------------------------------------------------- 1 | axiom (forall x : functionPtr :: {PTR_TO_FUNCPTR(FUNCPTR_TO_PTR(x))} PTR_TO_FUNCPTR(FUNCPTR_TO_PTR(x)) == x); 2 | axiom (forall x : ptr :: {FUNCPTR_TO_PTR(PTR_TO_FUNCPTR(x))} FUNCPTR_TO_PTR(PTR_TO_FUNCPTR(x)) == x); 3 | -------------------------------------------------------------------------------- /testsuite/CUDA/function_pointers/funcptr_to_ptr_add/axioms.bpl: -------------------------------------------------------------------------------- 1 | axiom (forall x : functionPtr :: {PTR_TO_FUNCPTR(FUNCPTR_TO_PTR(x))} PTR_TO_FUNCPTR(FUNCPTR_TO_PTR(x)) == x); 2 | axiom (forall x : ptr :: {FUNCPTR_TO_PTR(PTR_TO_FUNCPTR(x))} FUNCPTR_TO_PTR(PTR_TO_FUNCPTR(x)) == x); 3 | -------------------------------------------------------------------------------- /testsuite/CUDA/function_pointers/unknown_function/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:BUGLE_ERROR 2 | //--blockDim=1024 --gridDim=1 --no-inline 3 | //error: Unsupported function pointer 4 | 5 | typedef double(*funcType)(double); 6 | 7 | __device__ double bar(double x) { 8 | return sin(x); 9 | } 10 | 11 | __global__ void foo(double x, int i) 12 | { 13 | funcType f; 14 | 15 | if (i == 0) 16 | f = bar; 17 | else 18 | f = cos; 19 | 20 | f(x); 21 | } 22 | -------------------------------------------------------------------------------- /testsuite/CUDA/inheritance_struct_simplify/direct/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=2048 --gridDim=64 3 | 4 | struct s { 5 | int x; 6 | }; 7 | 8 | struct t : s { 9 | }; 10 | 11 | __global__ void foo(t p, t q) { 12 | p.x = q.x; 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/CUDA/inheritance_struct_simplify/indirect/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=2048 --gridDim=64 3 | 4 | struct s { 5 | int x; 6 | }; 7 | 8 | struct t : s { 9 | }; 10 | 11 | struct u : t { 12 | }; 13 | 14 | __global__ void foo(u p, u q) { 15 | p.x = q.x; 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/CUDA/large_constant_array/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=2048 --gridDim=2 --no-inline 3 | 4 | __constant__ int A[4096]; 5 | __constant__ int B[3] = {0,1,2}; 6 | 7 | __global__ void kernel() { 8 | int x = A[threadIdx.x] + B[0]; 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/CUDA/local2darrayaccess/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=10 --gridDim=64 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | 7 | __global__ void foo() { 8 | 9 | __shared__ int A[10][10]; 10 | 11 | A[threadIdx.y][threadIdx.x] = 2; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/CUDA/localarrayaccess/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=10 --gridDim=64 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | 7 | __global__ void foo() { 8 | 9 | __shared__ int A[11]; 10 | 11 | A[threadIdx.x] = 2; 12 | 13 | __syncthreads (); 14 | 15 | int x = A[threadIdx.x + 1]; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/CUDA/loop_unwind/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--blockDim=512 --gridDim=64 --loop-unwind=2 --no-inline 3 | //kernel.cu: error: possible write-write race on B 4 | #include 5 | 6 | extern "C" { 7 | 8 | __global__ void helloCUDA(float *A) 9 | { 10 | __shared__ float B[256]; 11 | for(int i = 0; i < 10; i ++) { 12 | B[i] = A[i]; 13 | } 14 | 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/CUDA/memcpy/arrayofstruct/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--gridDim=1 --blockDim=2 --no-inline 3 | 4 | //This kernel is race-free. 5 | // 6 | //It uses uses struct-assignment, which is translated into a memcpy by clang and 7 | //dealt with as a series of reads/writes by bugle. 8 | 9 | typedef struct { 10 | short x; 11 | short y; 12 | } pair_t; 13 | 14 | __global__ void k(pair_t *pairs) { 15 | pair_t fresh; 16 | pairs[threadIdx.x] = fresh; 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/CUDA/memcpy/fail_arrayofstruct/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--gridDim=1 --blockDim=2 --no-inline 3 | 4 | //This kernel is racy. 5 | // 6 | //It uses uses struct-assignment, which is translated into a memcpy by clang and 7 | //dealt with as a series of reads/writes by bugle. 8 | 9 | typedef struct { 10 | short x; 11 | short y; 12 | } pair_t; 13 | 14 | __global__ void k(pair_t *pairs) { 15 | pair_t fresh; 16 | pairs[42] = fresh; 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/CUDA/memcpy/null_dst/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--gridDim=1 --blockDim=2 --no-inline 3 | 4 | //This kernel has a null pointer access. 5 | 6 | #define memcpy(dst, src, len) __builtin_memcpy(dst, src, len) 7 | 8 | typedef struct { 9 | short x; 10 | short y; 11 | } s_t; //< sizeof(s2_t) == 4 12 | 13 | __global__ void k(s_t *in, s_t *out) { 14 | memcpy(0, &in[threadIdx.x], sizeof(s_t)); 15 | } 16 | -------------------------------------------------------------------------------- /testsuite/CUDA/memcpy/null_src/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--gridDim=1 --blockDim=2 --no-inline 3 | 4 | //This kernel has a null pointer access. 5 | 6 | #define memcpy(dst, src, len) __builtin_memcpy(dst, src, len) 7 | 8 | typedef struct { 9 | short x; 10 | short y; 11 | } s_t; //< sizeof(s2_t) == 4 12 | 13 | __global__ void k(s_t *in, s_t *out) { 14 | memcpy(&out[threadIdx.x], 0, sizeof(s_t)); 15 | } 16 | -------------------------------------------------------------------------------- /testsuite/CUDA/memcpy_simplification/array_element_passed_to_call1/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=256 --gridDim=128 3 | 4 | struct s { 5 | int a; 6 | }; 7 | 8 | __device__ void bar(s x); 9 | 10 | __global__ void foo(s *x) 11 | { 12 | bar(x[0]); 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/CUDA/memcpy_simplification/array_element_passed_to_call2/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=256 --gridDim=128 3 | 4 | struct s { 5 | int a; 6 | }; 7 | 8 | __device__ void bar(s x); 9 | 10 | __global__ void foo(s *x) 11 | { 12 | bar(x[1]); 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/CUDA/memcpy_simplification/global_passed_to_call/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=256 --gridDim=128 3 | 4 | texture texDKey128; 5 | 6 | __global__ void foo() 7 | { 8 | tex1Dfetch(texDKey128, 4); 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/CUDA/memcpy_simplification/i8_element_global_passed_to_call1/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=256 --gridDim=128 3 | 4 | struct s { 5 | char a; 6 | }; 7 | 8 | s x; 9 | 10 | __device__ void bar(s x); 11 | 12 | __global__ void foo() 13 | { 14 | bar(x); 15 | } 16 | -------------------------------------------------------------------------------- /testsuite/CUDA/memcpy_simplification/i8_element_global_passed_to_call2/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=256 --gridDim=128 3 | 4 | struct s { 5 | struct t { 6 | struct u { 7 | char a; 8 | } b; 9 | } c; 10 | }; 11 | 12 | s x; 13 | 14 | __device__ void bar(s x); 15 | 16 | __global__ void foo() 17 | { 18 | bar(x); 19 | } 20 | -------------------------------------------------------------------------------- /testsuite/CUDA/memcpy_simplification/i8_element_parameter_passed_to_call/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=256 --gridDim=128 3 | 4 | struct s { 5 | char a; 6 | }; 7 | 8 | __device__ void bar(s x); 9 | 10 | __global__ void foo(s x) 11 | { 12 | bar(x); 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/CUDA/memcpy_simplification/parameter_passed_to_call/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=256 --gridDim=128 3 | 4 | struct s { 5 | int a; 6 | }; 7 | 8 | __device__ void bar(s x); 9 | 10 | __global__ void foo(s x) 11 | { 12 | bar(x); 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/CUDA/memcpy_simplification/shared_element_passed_to_call/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=256 --gridDim=128 3 | 4 | struct s { 5 | int a; 6 | }; 7 | 8 | __device__ void bar(s x); 9 | 10 | __global__ void foo() 11 | { 12 | __shared__ s y[4]; 13 | bar(y[3]); 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/CUDA/memset/initstruct/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--gridDim=1 --blockDim=32 --no-inline 3 | 4 | __global__ void kernel(uint4 *out) { 5 | uint4 vector = {0,0,0,0}; 6 | out[threadIdx.x] = vector; 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/CUDA/memset/null_dst/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--gridDim=1 --blockDim=32 --no-inline 3 | 4 | #define memset(dst,val,len) __builtin_memset(dst,val,len) 5 | 6 | __device__ int bar(void); 7 | 8 | __global__ void kernel(uint4 *out) { 9 | memset(0, 0, 16); 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/CUDA/memset/unhandled_varlen/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:BUGLE_ERROR 2 | //--gridDim=1 --blockDim=32 --no-inline 3 | 4 | //This kernel is racy: memset is called with variable length. 5 | #define memset(dst,val,len) __builtin_memset(dst,val,len) 6 | 7 | __device__ int bar(void); 8 | 9 | __global__ void kernel(uint4 *out) { 10 | uint4 vector; 11 | int len = bar(); 12 | memset(&vector, 0, len); 13 | out[threadIdx.x] = vector; 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/CUDA/memset/unhandled_varval/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:BUGLE_ERROR 2 | //--gridDim=1 --blockDim=32 --no-inline 3 | 4 | //This kernel is not-racy: memset is called with variable value. 5 | #define memset(dst,val,len) __builtin_memset(dst,val,len) 6 | 7 | __device__ int bar(void); 8 | 9 | __global__ void kernel(uint4 *out) { 10 | uint4 vector; 11 | int val = bar(); 12 | memset(&vector, val, 16); 13 | out[threadIdx.x] = vector; 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/CUDA/memset_simplification/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=2048 --gridDim=64 3 | 4 | struct s { 5 | float x, y, z; 6 | }; 7 | 8 | __global__ void foo(s *q) { 9 | s p = { 0.0f, 0.0f, 0.0f }; 10 | q[threadIdx.x + blockIdx.x * blockDim.x] = p; 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/CUDA/misc/fail/miscfail1/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:CLANG_ERROR 2 | //--blockDim=4 --gridDim=2 --no-inline 3 | //kernel.cu:8:3:[\s]+error: use of undeclared identifier 'foo' 4 | 5 | #include 6 | 7 | __global__ void k() { 8 | foo(); 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/CUDA/misc/fail/miscfail5/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--gridDim=1 --blockDim=4 --no-inline 3 | //attempt to modify constant memory 4 | 5 | __constant__ int global_constant[4]; 6 | 7 | __global__ void constant(int *in) { 8 | global_constant[threadIdx.x] = in[threadIdx.x]; 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/CUDA/misc/fail/miscfail6/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--blockDim=1024 --gridDim=1024 3 | //0-sized 4 | 5 | __device__ double C[1024][0][1024]; 6 | 7 | __global__ void foo(double *H) { 8 | C[threadIdx.x][threadIdx.y][threadIdx.z] = H[threadIdx.x]; 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/CUDA/misc/fail/miscfail7/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--blockDim=1024 --gridDim=1 3 | //null pointer access 4 | 5 | __global__ void foo(int *H) { 6 | size_t tmp = (size_t)H; 7 | tmp += sizeof(int); 8 | int *G = (int *)tmp; 9 | G -= 1; 10 | G[threadIdx.x] = threadIdx.x; 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/CUDA/misc/fail/miscfail8/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--blockDim=2 --gridDim=2 3 | //assert 4 | 5 | typedef struct { 6 | unsigned int a, b; 7 | } pair; 8 | 9 | __device__ void assertion(pair A) { 10 | __assert(false); 11 | } 12 | 13 | __global__ void test(pair A) 14 | { 15 | assertion(A); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/CUDA/misc/pass/misc2/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=512 --gridDim=1 --no-inline 3 | 4 | #include 5 | 6 | __global__ void helloCUDA(volatile int* p) 7 | { 8 | __assert(__no_read(p)); 9 | p[threadIdx.x] = threadIdx.x; 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/CUDA/misc/pass/misc3/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--blockDim=1024 --gridDim=1 --no-inline 3 | //possible attempt to modify constant memory 4 | 5 | __constant__ int A[1024]; 6 | 7 | __global__ void foo(int *B) { 8 | A[threadIdx.x] = B[threadIdx.x]; 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/CUDA/misc/pass/misc4/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--gridDim=1024 --blockDim=1024 --no-inline 3 | 4 | __device__ void bar(int i); 5 | 6 | __global__ void 7 | foo(int w, int h) 8 | { 9 | __requires(h == 0); 10 | 11 | for (int i = threadIdx.x; 12 | __invariant(h == 0), 13 | i < w; i += blockDim.x) 14 | { 15 | if (h == 0) 16 | bar(5); 17 | else 18 | __assert(0); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /testsuite/CUDA/misc/pass/misc6/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=2 --gridDim=1 3 | 4 | __device__ char nondet(); 5 | 6 | __global__ void foo() 7 | { 8 | while (nondet()) 9 | { 10 | char r; // r not initialised 11 | 12 | if (r != nondet()) 13 | { 14 | goto RECORD_RESULT; 15 | } 16 | } 17 | 18 | RECORD_RESULT: 19 | 20 | ; 21 | } 22 | -------------------------------------------------------------------------------- /testsuite/CUDA/misc/pass/misc7/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=2 --gridDim=1 3 | 4 | __global__ void foo(char **argument) 5 | { 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/CUDA/misc/pass/misc8/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=1024 --gridDim=1 3 | 4 | __device__ void bar(char **in, char **out) { 5 | char tmp = (*in)[threadIdx.x]; 6 | out[0][threadIdx.x] = tmp; 7 | *out = *in; 8 | } 9 | 10 | __global__ void foo(char *A, char *B, char c) 11 | { 12 | char *choice1 = c ? A : B; 13 | char *choice2 = c ? B : A; 14 | bar(&choice1, &choice2); 15 | bar(&choice1, &choice2); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/CUDA/mul24/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=1024 --gridDim=1024 --no-inline 3 | 4 | #include 5 | 6 | __global__ void mul24_test (int* A, int* B) 7 | { 8 | int idxa = __mul24(blockIdx.x, blockDim.x) + threadIdx.x; 9 | unsigned int idxb = __umul24(blockIdx.x, blockDim.x) + threadIdx.x; 10 | 11 | A[idxa] = idxa; 12 | B[idxb] = idxa; 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/CUDA/multiplelocals/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | __global__ void foo() { 7 | { 8 | int x = 4; 9 | } 10 | { 11 | int x = 2; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/CUDA/nestedinline/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | #include 4 | 5 | inline __device__ void f() __attribute__((always_inline)); 6 | inline __device__ void f() { 7 | } 8 | 9 | inline __device__ void g() __attribute__((always_inline)); 10 | inline __device__ void g() { 11 | f(); 12 | } 13 | 14 | __global__ void k() { 15 | g(); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/CUDA/nonpointerparameter1/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | __global__ void foo(int p) { 7 | 8 | int x = p; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/CUDA/nonpointerparameter2/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | __device__ void bar(int x) { 7 | 8 | } 9 | 10 | __global__ void foo() { 11 | 12 | bar(5); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/CUDA/noraceduetoreturn/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=1 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | 7 | __device__ int bar(float* A) { 8 | 9 | if(threadIdx.x != 0) { 10 | return 0; 11 | } 12 | 13 | A[4] = 26.8f; 14 | 15 | return 1; 16 | 17 | } 18 | 19 | __global__ void foo(float* A) { 20 | 21 | int y = bar(A); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /testsuite/CUDA/notunaryoptest/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | __global__ void foo() { 7 | 8 | int x = 1; 9 | 10 | x = !x; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/CUDA/param_values/value_in_assert/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--blockDim=16 --gridDim=16 --no-inline 3 | //a = 12 4 | //b = 36 5 | //c = 48 6 | 7 | __global__ void example(unsigned a, unsigned b, unsigned c) { 8 | 9 | __requires(a == 12); 10 | __requires(b == 36); 11 | 12 | __assert(a + b != c); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/CUDA/pointeranalysistests/testinterprocedural/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | #include "cuda.h" 4 | 5 | __device__ void bar (int *p){ 6 | 7 | int a; 8 | 9 | p = &a; 10 | } 11 | 12 | 13 | __global__ void foo (int* p, int* q){ 14 | 15 | bar(p); 16 | 17 | bar(q); 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/CUDA/pointeranalysistests/testinterprocedural2/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | #include "cuda.h" 4 | 5 | __device__ void bar (int *p){ 6 | 7 | int a; 8 | 9 | p = &a; 10 | } 11 | 12 | 13 | __global__ void foo (int* p, int* q){ 14 | 15 | if (*p > 10){ 16 | bar(p); 17 | } 18 | else { 19 | bar(q); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /testsuite/CUDA/pointers_in_structs/test1/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=2 --gridDim=2 3 | 4 | struct S { 5 | int * p; 6 | }; 7 | 8 | __global__ void foo(int * A) { 9 | 10 | S myS; 11 | myS.p = A; 12 | int * q; 13 | q = myS.p; 14 | q[threadIdx.x + blockDim.x*blockIdx.x] = threadIdx.x; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/CUDA/pointers_in_structs/test2/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=2 --gridDim=2 3 | 4 | struct S { 5 | int * p; 6 | }; 7 | 8 | __global__ void foo(struct S A) { 9 | A.p[threadIdx.x + blockDim.x*blockIdx.x] = threadIdx.x; 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/CUDA/pointers_in_structs/test3/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=2 --gridDim=2 3 | 4 | struct S { 5 | struct { 6 | int * p; 7 | } s; 8 | }; 9 | 10 | __global__ void foo(struct S A) { 11 | A.s.p[threadIdx.x + blockDim.x*blockIdx.x] = threadIdx.x; 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/CUDA/pointers_in_structs/test4/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=2 --gridDim=2 3 | 4 | struct S { 5 | struct { 6 | int * p; 7 | int * q; 8 | } s; 9 | }; 10 | 11 | __global__ void foo(struct S A) { 12 | A.s.p[threadIdx.x + blockDim.x*blockIdx.x] = 13 | A.s.q[threadIdx.x + blockDim.x*blockIdx.x] + threadIdx.x; 14 | A.s.q[threadIdx.x + blockDim.x*blockIdx.x] = threadIdx.x; 15 | } 16 | -------------------------------------------------------------------------------- /testsuite/CUDA/pointertests/cast/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--blockDim=32 --gridDim=64 --no-inline 3 | //error: possible write-write race on 4 | 5 | 6 | #include "cuda.h" 7 | 8 | #define N 32 9 | 10 | 11 | __global__ void foo(int* p) { 12 | __shared__ unsigned char x[N]; 13 | 14 | for (unsigned int i=0; i<(N/4); i++) { 15 | ((unsigned int *)x)[i] = threadIdx.x; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/CUDA/pointertests/scanlargelike/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=32 --gridDim=64 --no-inline 3 | #include 4 | 5 | #define N 32 6 | 7 | __device__ void f(float *odata, int* ai) { 8 | int thid = threadIdx.x; 9 | *ai = thid; 10 | } 11 | 12 | __global__ void k(float *g_odata) { 13 | int ai; 14 | f(g_odata,&ai); 15 | } 16 | 17 | -------------------------------------------------------------------------------- /testsuite/CUDA/pointertests/test1/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=1 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | 7 | __global__ void foo(int* p) { 8 | 9 | p[threadIdx.x] = 0; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/CUDA/pointertests/test10/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=10 --gridDim=64 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | 7 | __global__ void foo() { 8 | 9 | __shared__ int A[11]; 10 | 11 | int* p = A + 1; 12 | 13 | p[threadIdx.x] = 0; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /testsuite/CUDA/pointertests/test11/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=10 --gridDim=64 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | 7 | __device__ void bar(int* p) { 8 | p[threadIdx.x] = 0; 9 | } 10 | 11 | 12 | __global__ void foo() { 13 | 14 | __shared__ int A[10]; 15 | 16 | int* p = A; 17 | 18 | bar(p); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /testsuite/CUDA/pointertests/test12/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | int gB = 200; 7 | 8 | __device__ int* bar(int* p) { 9 | return p; 10 | } 11 | 12 | 13 | __global__ void foo(int* q, int* r) { 14 | 15 | __shared__ int A[10]; 16 | 17 | __shared__ int* p; 18 | p = A; 19 | 20 | bar(p);//[threadIdx.x] = 0; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /testsuite/CUDA/pointertests/test13/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=1 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | 7 | __global__ void foo(int* glob) { 8 | 9 | int a; 10 | 11 | int* p; 12 | 13 | a = 0; 14 | 15 | p = &a; 16 | 17 | *p = threadIdx.x; 18 | 19 | glob[*p] = threadIdx.x; 20 | 21 | 22 | } 23 | -------------------------------------------------------------------------------- /testsuite/CUDA/pointertests/test14/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | __global__ void foo(int* p) { 7 | __shared__ int x[32]; 8 | int *ptr_p = p + threadIdx.x; 9 | int *ptr_x = x + threadIdx.x; 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/CUDA/pointertests/test2/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=1 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | 7 | __global__ void foo(int* p) { 8 | 9 | int* q; 10 | 11 | q = p; 12 | 13 | q[threadIdx.x] = 0; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /testsuite/CUDA/pointertests/test3/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=1 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | 7 | __global__ void foo(int* p) { 8 | 9 | int* q; 10 | 11 | q = p + 1; 12 | 13 | q[threadIdx.x] = 0; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /testsuite/CUDA/pointertests/test4/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=1 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | 7 | __device__ void bar(int* p) { 8 | p[threadIdx.x] = 0; 9 | } 10 | 11 | __global__ void foo(int* p) { 12 | 13 | bar(p); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /testsuite/CUDA/pointertests/test5/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=1 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | 7 | __device__ int* bar(int* p) { 8 | __ensures(__implies(__enabled(), __return_val_ptr() == p)); 9 | return p; 10 | } 11 | 12 | __global__ void foo(int* p) { 13 | 14 | int* q = bar(p); 15 | 16 | q[threadIdx.x] = 0; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/CUDA/pointertests/test6/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=1 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | 7 | __device__ int* bar(int* p) { 8 | __ensures(__implies(__enabled(), __return_val_ptr() == p)); 9 | return p; 10 | } 11 | 12 | __global__ void foo(int* p) { 13 | 14 | bar(p)[threadIdx.x] = 0; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/CUDA/pointertests/test7/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | __global__ void foo() { 7 | 8 | int a; 9 | 10 | int* local_ptr; 11 | 12 | local_ptr = &a; 13 | 14 | *local_ptr = 0; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/CUDA/pointertests/test8/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=10 --gridDim=64 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | 7 | __global__ void foo() { 8 | 9 | __shared__ int A[10]; 10 | 11 | A[threadIdx.x] = 0; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/CUDA/pointertests/test9/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=10 --gridDim=64 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | 7 | __global__ void foo() { 8 | 9 | __shared__ int A[10]; 10 | 11 | int* p = A; 12 | 13 | p[threadIdx.x] = 0; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /testsuite/CUDA/pointertests/test_bad_pointer_procedure_call/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | __device__ void bar(int* q) { 7 | 8 | } 9 | 10 | __global__ void foo(int* p) { 11 | 12 | __shared__ int A[10]; 13 | 14 | bar(p); 15 | 16 | bar(A); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/CUDA/pointertests/test_copy_between_memory_spaces/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=1 --equality-abstraction --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | 7 | __global__ void foo(int* p) { 8 | 9 | __shared__ int A[10]; 10 | 11 | p[0] = A[0]; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/CUDA/pointertests/test_copy_between_pointers/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --equality-abstraction --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | __global__ void foo(int* p) { 7 | 8 | __shared__ int A[10]; 9 | 10 | int* x; 11 | 12 | x = p; 13 | 14 | x[0] = 0; 15 | 16 | x = A; 17 | 18 | x[0] = 0; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /testsuite/CUDA/pointertests/test_pass_value_from_array/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | __device__ void bar(float x) { 7 | 8 | } 9 | 10 | __global__ void foo(int* A) { 11 | 12 | bar(A[0]); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/CUDA/predication/test1/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=2 --gridDim=1 3 | 4 | __device__ char nondet(); 5 | 6 | __global__ void foo() { 7 | while(nondet()) 8 | { 9 | while (nondet()) 10 | { 11 | 12 | } 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /testsuite/CUDA/reduced_strength_with_requires/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=1024 --gridDim=1 --no-inline 3 | 4 | #include 5 | 6 | 7 | __global__ void foo(float *A, int sz) { 8 | __requires(sz == blockDim.x); 9 | for(int i = threadIdx.x; i < 100*sz; i += sz) { 10 | A[i] *= 2.0f; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/CUDA/return_val/char/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:BUGLE_ERROR 2 | //--blockDim=1024 --gridDim=1 --no-inline 3 | //error: Type of __return_val function does not match return type 4 | 5 | __device__ char multiplyByTwo(int i) 6 | { 7 | __ensures(__return_val_int() == i * 2); 8 | return i * 2; 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/CUDA/return_val/longlong/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:BUGLE_ERROR 2 | //--blockDim=1024 --gridDim=1 --no-inline 3 | //error: Type of __return_val function does not match return type 4 | 5 | __device__ long long multiplyByTwo(int i) 6 | { 7 | __ensures(__return_val_int() == i * 2); 8 | return i * 2; 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/CUDA/simpleparampassing/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | __device__ void f(int x) { 7 | 8 | } 9 | 10 | __global__ void foo() { 11 | 12 | f(2); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/CUDA/simplereturn/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | __device__ int f(int x) { 7 | return x + 1; 8 | } 9 | 10 | __global__ void foo() { 11 | 12 | int y = f(2); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/CUDA/store_in_byval_function/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=2048 --gridDim=64 3 | 4 | class s { 5 | int *p; 6 | 7 | public: 8 | __device__ void store(int val) { 9 | p[threadIdx.x + blockDim.x * blockIdx.x] = val; 10 | } 11 | }; 12 | 13 | __global__ void foo(s q) { 14 | q.store(42); 15 | } 16 | -------------------------------------------------------------------------------- /testsuite/CUDA/struct/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include 5 | 6 | typedef struct { 7 | float x,y,z,w; 8 | } myfloat4; 9 | 10 | __global__ void k() { 11 | myfloat4 f4; 12 | float i0 = f4.x; 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/CUDA/ternarytest/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=1 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | 7 | __global__ void foo(float* A) { 8 | 9 | A[threadIdx.x == 0 ? 1 : 2*threadIdx.x] = 2.4f; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/CUDA/ternarytest2/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=1 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | 7 | __global__ void foo(float* A) { 8 | 9 | A[threadIdx.x ? 2*threadIdx.x : 1] = 2.4f; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/CUDA/test_for_get_group_id/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=1 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | 7 | __global__ void foo(float* A) { 8 | 9 | if(blockIdx.x == 0) { 10 | A[threadIdx.x] = 42.f; 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/CUDA/threadfence/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=32 --gridDim=2 3 | 4 | __global__ void foo() { 5 | __threadfence(); 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/CUDA/unusedreturn/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=64 --gridDim=64 --no-inline 3 | 4 | #include "cuda.h" 5 | 6 | __device__ int bar () { 7 | return 0; 8 | } 9 | 10 | __global__ void foo() { 11 | bar (); 12 | } 13 | 14 | -------------------------------------------------------------------------------- /testsuite/CUDA/warpsize/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=2048 --gridDim=64 3 | 4 | __global__ void foo(int *r) { 5 | r[threadIdx.x + blockIdx.x * blockDim.x] = warpSize; 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/CUDA/warpsync/bad_inter_group/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--blockDim=128 --gridDim=128 --warp-sync=32 --no-inline 3 | //kernel.cu: error: possible read-write race on A 4 | 5 | __global__ void foo(int* A) { 6 | 7 | A[ blockIdx.x*blockDim.x + threadIdx.x ] += (A[ (blockIdx.x + 1)*blockDim.x + threadIdx.x ]); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/CUDA/warpsync/broken_shuffle/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--blockDim=1024 --gridDim=1 --warp-sync=16 --no-inline 3 | 4 | #include 5 | 6 | __global__ void shuffle (int* A) 7 | { 8 | int tid = threadIdx.x; 9 | int warp = tid / 32; 10 | int* B = A + (warp*32); 11 | A[tid] = B[(tid + 1)%32]; 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/CUDA/warpsync/equality_abstraction_issue/kernel.cu: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--warp-sync=32 --blockDim=32 --gridDim=1 --equality-abstraction --no-inline 3 | //kernel.cu:10 4 | 5 | __global__ void foo(int * A) { 6 | A[0] = 1; 7 | A[1] = 1; 8 | A[2] = 1; 9 | A[threadIdx.x] = 0; 10 | __assert(A[0] == 1 | A[1] == 1 | A[2] == 1); 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/CUDA/warpsync/refined_equality_abstraction/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--warp-sync=32 --blockDim=32 --gridDim=1 --equality-abstraction --no-inline 3 | 4 | __global__ void foo(int * A, int * B) { 5 | A[threadIdx.x] = 1; 6 | volatile int x = A[threadIdx.x]; 7 | B[threadIdx.x] = 1; 8 | volatile int y = A[threadIdx.x]; 9 | __assert(x == y); 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/CUDA/warpsync/shuffle/kernel.cu: -------------------------------------------------------------------------------- 1 | //pass 2 | //--blockDim=512 --gridDim=1 --warp-sync=32 --no-inline 3 | 4 | #include 5 | 6 | __global__ void shuffle (int* A) 7 | { 8 | int tid = threadIdx.x; 9 | int warp = tid / 32; 10 | int* B = A + (warp*32); 11 | A[tid] = B[(tid + 1)%32]; 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/abstract_add/associativity/axioms.bpl: -------------------------------------------------------------------------------- 1 | type T = bv32; 2 | 3 | axiom (forall x, y, z : T :: { A1(x, A(y, z)) } A1(x, A(y, z)) == A1(A(x, y), z)); 4 | axiom (forall x, y : T :: { A1(x, y) } A1(x, y) == A(x, y)); 5 | axiom (forall x, y, z : T :: { A1(A(x, y), z) } A1(A(x, y), z) == A(A1(x, y), z)); 6 | -------------------------------------------------------------------------------- /testsuite/OpenCL/abstract_add/associativity_char/axioms.bpl: -------------------------------------------------------------------------------- 1 | type T = bv8; 2 | 3 | function {:bvbuiltin "bvule"} ULE(T, T) : bool; 4 | 5 | axiom (forall x, y, z : T :: { A1(x, A(y, z)) } A1(x, A(y, z)) == A1(A(x, y), z)); 6 | axiom (forall x, y : T :: { A1(x, y) } A1(x, y) == A(x, y)); 7 | axiom (forall x, y, z : T :: { A1(A(x, y), z) } A1(A(x, y), z) == A(A1(x, y), z)); 8 | 9 | axiom (forall x, y : T :: { A(x, y) } ULE(x, A(x, y)) && ULE(y, A(x, y))); -------------------------------------------------------------------------------- /testsuite/OpenCL/abstract_add/associativity_short/axioms.bpl: -------------------------------------------------------------------------------- 1 | type T = bv16; 2 | 3 | axiom (forall x, y, z : T :: { A1(x, A(y, z)) } A1(x, A(y, z)) == A1(A(x, y), z)); 4 | axiom (forall x, y : T :: { A1(x, y) } A1(x, y) == A(x, y)); 5 | axiom (forall x, y, z : T :: { A1(A(x, y), z) } A1(A(x, y), z) == A(A1(x, y), z)); 6 | -------------------------------------------------------------------------------- /testsuite/OpenCL/abstract_add/fail_decreasing/axioms.bpl: -------------------------------------------------------------------------------- 1 | type T = bv32; 2 | 3 | function {:bvbuiltin "bvule"} ULE(T, T) : bool; 4 | 5 | axiom (forall x, y : T :: { A(x, y) } ULE(x, A(x, y)) && ULE(y, A(x, y))); -------------------------------------------------------------------------------- /testsuite/OpenCL/abstract_add/increasing/axioms.bpl: -------------------------------------------------------------------------------- 1 | type T = bv32; 2 | 3 | function {:bvbuiltin "bvule"} ULE(T, T) : bool; 4 | 5 | axiom (forall x, y : T :: { A(x, y) } ULE(x, A(x, y)) && ULE(y, A(x, y))); -------------------------------------------------------------------------------- /testsuite/OpenCL/abstract_add/increasing/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --boogie-file=${KERNEL_DIR}/axioms.bpl --no-inline 3 | 4 | DECLARE_UF_BINARY(A, unsigned, unsigned, unsigned); 5 | 6 | __kernel void foo(unsigned x, unsigned y) { 7 | unsigned z; 8 | z = A(x, y); 9 | __assert(z >= x && z >= y); 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/abstract_add/zero/axioms.bpl: -------------------------------------------------------------------------------- 1 | type T = bv32; 2 | 3 | function {:bvbuiltin "bvule"} ULE(T, T) : bool; 4 | 5 | axiom (forall x, y : T :: { A(x, y) } ULE(x, A(x, y)) && ULE(y, A(x, y))); 6 | axiom (forall x : T :: { A(x, 0bv32) } A(x, 0bv32) == x); 7 | axiom (forall x : T :: { A(0bv32, x) } A(0bv32, x) == x); -------------------------------------------------------------------------------- /testsuite/OpenCL/abstract_add/zero/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --boogie-file=${KERNEL_DIR}/axioms.bpl --no-inline 3 | 4 | DECLARE_UF_BINARY(A, unsigned, unsigned, unsigned); 5 | 6 | __kernel void foo(unsigned x, unsigned y) { 7 | unsigned z; 8 | z = A(x, 0); 9 | __assert(z == x); 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/addressofinit/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | void bar(int * i) 6 | {} 7 | 8 | __kernel void foo() { 9 | 10 | int i = 0; 11 | i=0; 12 | 13 | bar(&i); 14 | } 15 | 16 | 17 | -------------------------------------------------------------------------------- /testsuite/OpenCL/addressofread/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | int bar(void); 5 | 6 | void baz(int* i) 7 | {} 8 | 9 | __kernel void foo() { 10 | int normal; 11 | int i = bar(); 12 | 13 | normal=i; 14 | 15 | baz(&i); 16 | } 17 | 18 | 19 | -------------------------------------------------------------------------------- /testsuite/OpenCL/alignment/initialisation/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | __constant int3 c[2] = {{0, 0, 0}, {1, 0, 0}}; 5 | 6 | __kernel void foo() 7 | { 8 | __assert(c[0].x == 0); 9 | __assert(c[1].x == 1); 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/alignment/int3int4/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | __kernel void foo(__global int3 *n) 5 | { 6 | n[get_global_id(0)] = get_global_id(0); 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/OpenCL/alignment/race_location/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=64 --num_groups=64 --no-inline 3 | //possible write-write race on n\[200\] 4 | 5 | __kernel void foo(__global int3 *n) 6 | { 7 | n[200] = get_global_id(0); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/always_inline/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | int bar() __attribute__((always_inline)); 6 | 7 | int bar() 8 | { 9 | return 5; 10 | } 11 | 12 | __kernel void foo() 13 | { 14 | int x = bar(); 15 | __assert(x == 5); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/fail_assert_false/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=64 --num_groups=64 --no-inline 3 | //kernel.cl:7:3:[\s]+error:[\s]+this assertion might not hold for work item [\d]+ with local id [\d]+ in work group [\d]+[\s]+__assert\(false\); 4 | 5 | __kernel void foo() 6 | { 7 | __assert(false); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/fail_assume_true/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=64 --num_groups=64 --no-inline 3 | //kernel.cl:9:3:[\s]+error:[\s]+this assertion might not hold for work item [\d]+ with local id [\d]+ in work group [\d]+[\s]+__assert\(false\); 4 | 5 | 6 | __kernel void foo() 7 | { 8 | __assume(true); 9 | __assert(false); 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/fail_read_offset_global/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=2048 --num_groups=4 --no-inline 3 | //kernel.cl:12:[\d]+:[\s]+error:[\s]+this assertion might not hold for work item [\d]+ with local id [\d]+ in work group [\d]+[\s]+__assert\(__read_offset_bytes\(p\) == 42\); 4 | 5 | 6 | 7 | 8 | 9 | 10 | __kernel void foo(__global int* p) { 11 | 12 | __assert(__read_offset_bytes(p) == 42); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/global_ensures/pass/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1024 --no-inline 3 | 4 | 5 | 6 | void bar(__local int* A) { 7 | __global_requires(!__read(A)); 8 | __global_ensures(!__read(A)); 9 | } 10 | 11 | __kernel void foo(__local int* A) { 12 | 13 | if((get_local_id(0) % 2) == 0) { 14 | bar(A); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/global_requires/fail/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=1024 --num_groups=1024 --no-inline 3 | 4 | 5 | 6 | void baz(int x) { 7 | 8 | } 9 | 10 | void bar(int x) { 11 | __global_requires(x == 100); 12 | } 13 | 14 | __kernel void foo() { 15 | 16 | volatile int z = 50; 17 | if((get_local_id(0) % 2) == 0) { 18 | z = 100; 19 | bar(z); 20 | } 21 | 22 | baz(z); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/global_requires/pass/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1024 --no-inline 3 | 4 | 5 | 6 | void bar(int x) { 7 | __global_requires(x == 100); 8 | } 9 | 10 | __kernel void foo() { 11 | int z = 100; 12 | 13 | if((get_local_id(0) % 2) == 0) { 14 | bar(z); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/invariants_as_candidates/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --invariants-as-candidates 3 | 4 | __kernel void foo() { 5 | for (int i = 0; __invariant(0), i < 5; i++) {} 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/no_annotations/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-annotations 3 | 4 | __kernel void foo() { 5 | for (int i = 0; __invariant(0), i < 5; i++) {} 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/only_requires/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --only-requires 3 | 4 | __kernel void foo(global int * A, int j) { 5 | __requires(j == 0); 6 | for (int i = 0; __invariant(0), i < 5; i++) { 7 | A[get_global_id(0) + j] = A[get_global_id(0)]; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/shared_state_invariant_tests/simple_shared_state_invariant/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1024 --equality-abstraction --no-inline 3 | 4 | 5 | 6 | __kernel void foo() 7 | { 8 | __local int A[1024]; 9 | 10 | A[get_local_id(0)] = 0; 11 | 12 | for(int i = 0; __invariant(A[get_local_id(0)] == 0), i < 100; i++) { 13 | A[get_local_id(0)] = 0; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/test_all/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo(__global int* A) 6 | { 7 | 8 | __global_assert(__all(get_local_id(0) < get_local_size(0))); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/test_assert/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | void bar(int x) 6 | { 7 | __requires(__implies(__enabled(), x < 100)); 8 | } 9 | 10 | 11 | __kernel void foo(int y) 12 | { 13 | __assume(y < 100); 14 | 15 | __assert(y < 200); 16 | 17 | bar(y); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/test_assert_true/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo() 6 | { 7 | __assert(true); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/test_assume/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | void bar(int x) 6 | { 7 | __requires(__implies(__enabled(), x < 100)); 8 | } 9 | 10 | 11 | __kernel void foo(int y) 12 | { 13 | __assume(y < 100); 14 | 15 | bar(y); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/test_assume_false/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo() 6 | { 7 | __assume(false); 8 | __assert(false); 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/test_axiom/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=[16,16] --num_groups=[64,64,64] --no-inline 3 | 4 | 5 | 6 | 7 | __kernel void foo(__global int* A) { 8 | 9 | // Only race free because of axioms provided by command-line options 10 | if(get_local_size(0) != 16 || get_local_size(1) != 16) { 11 | A[0] = get_local_id(0); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/test_contract/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | void bar() 6 | { 7 | __requires(__implies(__enabled(), get_local_id(0) == 3)); 8 | } 9 | 10 | __kernel void foo() 11 | { 12 | if(get_local_id(0) == 3) 13 | { 14 | bar(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/test_distinct/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1024 --no-inline 3 | 4 | 5 | 6 | __kernel void foo() 7 | { 8 | 9 | for(int i = get_global_id(0); 10 | __invariant(__implies(__uniform_bool(__enabled()), __distinct_int(i))), 11 | i < 100; i++) 12 | { 13 | ; 14 | 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/test_enabled_and_uniform/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo(__global int* p) 6 | { 7 | for(int k = 0; 8 | __assert(__uniform_int(k)), 9 | __assert(__uniform_bool(__enabled())), 10 | k < 1000; k++) 11 | { 12 | ; 13 | ; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/test_exclusive/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo(__global int* A) 6 | { 7 | 8 | __global_assert(__implies(get_group_id(0) == __other_int(get_group_id(0)), __exclusive(get_local_id(0) == 4))); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/test_for_loop_invariant/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=[64,64] --num_groups=[64,64,64] --no-inline 3 | 4 | 5 | __kernel void foo() { 6 | 7 | for(int d = 1; 8 | __invariant(__uniform_bool(__enabled())), 9 | __invariant(__uniform_int(d)), 10 | __invariant(__implies(__enabled(), d == 1 | d == 2 | d == 4 | d == 8 | d == 16 | d == 32 | d == 64)), 11 | d < 64; d <<= 1) { 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/test_loop_invariant_then_assert/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo() { 6 | 7 | unsigned x = 0; 8 | 9 | while(__invariant(x <= 4), x < 4) 10 | { 11 | x = x + 1; 12 | } 13 | 14 | __assert(x == 4); 15 | 16 | } 17 | 18 | 19 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/test_loop_invariant_then_assert2/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=4 --num_groups=64 --no-inline 3 | 4 | 5 | 6 | __kernel void foo() { 7 | 8 | unsigned x = 0; 9 | 10 | while(__global_invariant(__implies(!__enabled(), x == get_local_id(0))), 11 | __invariant(x <= get_local_id(0)), x < get_local_id(0)) 12 | { 13 | x = x + 1; 14 | } 15 | 16 | __assert(x == get_local_id(0)); 17 | 18 | } 19 | 20 | 21 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/test_old/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | void bar(int p) 6 | { 7 | __ensures(p == __old_int(p)); 8 | 9 | } 10 | 11 | __kernel void foo() { 12 | 13 | bar(4); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/test_precondition_on_kernel/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | void bar(int x) 6 | { 7 | __requires(x < 100); 8 | } 9 | 10 | 11 | __kernel void foo(int y) 12 | { 13 | __requires(y < 100); 14 | 15 | bar(y); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/test_read_global/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=2048 --num_groups=4 --no-inline 3 | 4 | 5 | 6 | 7 | __kernel void foo(__global int* p, __global int* q) { 8 | 9 | p[get_global_id(0)] = q[get_global_id(0)]; 10 | 11 | __assert(!__read(p)); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/test_read_local/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=128 --num_groups=128 --no-inline 3 | 4 | 5 | 6 | __kernel void foo(__local int* p, __local int* q) { 7 | 8 | p[get_local_id(0)] = q[get_local_id(0)]; 9 | 10 | __assert(!__read(p)); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/test_read_offset/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo() 6 | { 7 | __local float A[1024]; 8 | __assert(__implies(__read(A), __read_offset_bytes(A) == 0)); 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/test_read_offset_global/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=2048 --num_groups=4 --no-inline 3 | 4 | 5 | 6 | 7 | __kernel void foo(__global int* p, __global int* q) { 8 | 9 | if(get_global_id(0) == 0) { 10 | p[4] = q[5]; 11 | __assert(__implies(__write(p) & __read(q), 12 | __read_offset_bytes(q) == __write_offset_bytes(p) + sizeof(int*))); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/test_write_global/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1024 --no-inline 3 | 4 | 5 | 6 | __kernel void foo(__global int* p, __global int* q) { 7 | 8 | p[get_global_id(0)] = q[get_global_id(0)]; 9 | 10 | __assert(!__write(q)); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/annotation_tests/test_write_local/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=128 --num_groups=128 --no-inline 3 | 4 | 5 | 6 | __kernel void foo(__local int* p, __local int* q) { 7 | 8 | p[get_local_id(0)] = q[get_local_id(0)]; 9 | 10 | __assert(!__write(q)); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/array_bounds_tests/array_in_array/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=8 --num_groups=8 --check-array-bounds 3 | //kernel.cl:9:[\d]+:[\s]+error:[\s]+possible array out-of-bounds access on array L 4 | 5 | 6 | __kernel void foo() { 7 | local int L[64]; 8 | local int G[64]; 9 | L[G[get_global_id(0)]] = get_global_size(0); 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/array_bounds_tests/array_in_array_2/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=[5,8] --num_groups=1 --check-array-bounds 3 | 4 | __kernel void foo() { 5 | int L[5] = {10, 20, 30, 40, 50}; 6 | int K[40]; 7 | K[get_global_id(1) * get_global_id(0)] = L[get_global_id(1) % 5]; 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/array_bounds_tests/array_in_array_param/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=8 --num_groups=8 --check-array-bounds 3 | //kernel.cl:7:[\d]+:[\s]+error:[\s]+possible array out-of-bounds access on array L 4 | 5 | __kernel void foo(global int* G) { 6 | local int L[64]; 7 | L[G[get_global_id(0)]] = get_global_size(0); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/array_bounds_tests/multi_dim_array/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=[8,8] --num_groups=8 --check-array-bounds 3 | 4 | __kernel void foo() { 5 | local int L[8][8]; 6 | L[get_local_id(0)][get_local_id(1)] = get_group_id(0); 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/OpenCL/array_bounds_tests/multi_dim_array_fail_upper/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=[10,10,10] --num_groups=2 --check-array-bounds 3 | //kernel.cl:7:[\d]+:[\s]+error:[\s]+possible array out-of-bounds access on array L 4 | 5 | __kernel void foo() { 6 | local int L[10][10][10]; 7 | L[get_global_id(0)][get_local_id(1)][get_local_id(2)] = get_group_id(0); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/array_bounds_tests/negative_index_multi_dim/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1,10 --num_groups=1,10 --check-array-bounds 3 | 4 | __kernel void foo() { 5 | local int L[10][10]; 6 | L[-1 * get_local_id(0)][get_global_id(1)] = get_global_size(0); 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/OpenCL/array_bounds_tests/negative_index_multi_dim_fail/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=1,10 --num_groups=1,10 --check-array-bounds 3 | //kernel.cl:7:[\d]+:[\s]+error:[\s]+possible array out-of-bounds access on array L 4 | 5 | __kernel void foo() { 6 | local int L[10][10]; 7 | L[-1 + get_global_id(0)][get_global_id(1)] = get_global_size(0); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/array_bounds_tests/private_array/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=4 --num_groups=4 --check-array-bounds 3 | 4 | __kernel void foo() { 5 | int L[16]; 6 | int x = get_global_id(0); 7 | L[x] = x * x; 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/array_bounds_tests/realign_simple/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=16 --num_groups=16 --check-array-bounds 3 | 4 | __kernel void foo() { 5 | local int L[64]; 6 | ((local char*)L)[get_global_id(0)] = get_global_size(0); 7 | } -------------------------------------------------------------------------------- /testsuite/OpenCL/array_bounds_tests/realign_simple_fail/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=20 --num_groups=16 --check-array-bounds 3 | //kernel.cl:7:[\d]+:[\s]+error:[\s]+possible array out-of-bounds access on array L 4 | 5 | __kernel void foo() { 6 | local int L[64]; 7 | ((local char*)L)[get_global_id(0)] = get_global_size(0); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/array_bounds_tests/simple_array/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=8 --num_groups=8 --check-array-bounds 3 | 4 | __kernel void foo() { 5 | local int L[64]; 6 | L[get_global_id(0)] = get_global_size(0); 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/OpenCL/array_bounds_tests/simple_array_fail_lower/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=8 --num_groups=8 --check-array-bounds 3 | //kernel.cl:7:[\d]+:[\s]+error:[\s]+possible array out-of-bounds access on array L 4 | 5 | __kernel void foo() { 6 | local int L[64]; 7 | L[0 - get_global_id(0)] = get_global_size(0); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/array_bounds_tests/simple_array_fail_upper/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=8 --num_groups=8 --check-array-bounds 3 | //kernel.cl:7:[\d]+:[\s]+error:[\s]+possible array out-of-bounds access on array L 4 | 5 | __kernel void foo() { 6 | local int L[25]; 7 | L[get_global_id(0)] = get_global_size(0); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/array_bounds_tests/simple_array_fail_var/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=8 --num_groups=8 --check-array-bounds 3 | //kernel.cl:8:[\d]+:[\s]+error:[\s]+possible array out-of-bounds access on array L 4 | 5 | __kernel void foo() { 6 | local int L[20]; 7 | int x = get_global_id(0); 8 | L[x] = x * x; 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/OpenCL/asymmetric_asserts/pass/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=32 --num_groups=32 --no-inline 3 | 4 | #define tid get_local_id(0) 5 | 6 | __kernel void foo(int x) { 7 | __requires(x > 32); 8 | 9 | int i = 0; 10 | 11 | while(__invariant(i >= 0), i < (x - (int)tid)) { 12 | 13 | i = i + 1; 14 | 15 | __assert(i >= 0); 16 | __assert(__other_bool(__implies(__enabled(), i >= 0))); 17 | 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /testsuite/OpenCL/async_work_group_copy/fail/test1/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=64 --num_groups=128 3 | 4 | #define N 64 5 | 6 | kernel void foo(global float* p) { 7 | 8 | local float mine[N]; 9 | 10 | event_t handle = async_work_group_copy(mine, p + N*get_group_id(0), N, 0); 11 | 12 | // Removed to introduce bug: wait_group_events(1, &handle); 13 | 14 | p[get_global_id(0)] = 2*mine[get_local_id(0)]; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/OpenCL/atomics/atomic_read_race/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=1024 --num_groups=1 --no-inline 3 | //error: possible read-atomic race 4 | 5 | __kernel void atomic (__local int* A) 6 | { 7 | volatile int x; 8 | x = A[get_local_id(0)]; 9 | atomic_inc(A); 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/atomics/counter/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1 --no-inline 3 | 4 | kernel void counter (local int* A) 5 | { 6 | local int count; 7 | if (get_local_id(0) == 0) 8 | count = 0; 9 | barrier(CLK_LOCAL_MEM_FENCE); 10 | A[atomic_inc(&count)] = get_local_id(0); 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/atomics/definitions_float/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1 --no-inline 3 | 4 | kernel void definitions (local float* E, global float* F) 5 | { 6 | atomic_xchg(E,10.0f); 7 | atomic_xchg(F,10.0f); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/atomics/displaced/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=1024 --num_groups=2 --no-inline 3 | //error: possible write-atomic race on A\[1\] \(byte 0\): 4 | 5 | __kernel void atomicTest(__local int *A, int B) 6 | { 7 | A[get_local_id(0) + 1] = 42; 8 | __local char *C = (__local char*)A; 9 | atomic_add((__local int*)(C + 1), B); 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/atomics/equality_fail/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:GPUVERIFYVCGEN_ERROR 2 | //--local_size=1024 --num_groups=1 --equality-abstraction --no-inline 3 | //GPUVerify: error: --equality-abstraction cannot be used with atomics\. 4 | 5 | kernel void simple (local int* A) 6 | { 7 | atomic_inc(A); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/atomics/histo/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1 --no-inline 3 | 4 | __kernel void atomic (__local int* A, 5 | __local int* B) 6 | { 7 | int tid = get_local_id(0); 8 | int t = A[tid]; 9 | atomic_inc(B + t); 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/atomics/mismatched_types/int_add_with_float/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=2 --no-inline 3 | 4 | __kernel void atomicTest(__local float *A, int B) 5 | { 6 | A[get_local_id(0) + 1] = 42; 7 | atomic_add((__local int*)A, B); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/atomics/mismatched_types/int_add_with_long/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=2 --no-inline 3 | 4 | __kernel void atomicTest(__local long *A, int B) 5 | { 6 | A[get_local_id(0) + 1] = 42; 7 | atomic_add((__local int*)A, B); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/atomics/mismatched_types/int_add_with_short/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=2 --no-inline 3 | 4 | __kernel void atomicTest(__local short *A, int B) 5 | { 6 | A[get_local_id(0) + 2] = 42; 7 | atomic_add((__local int*)A, B); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/atomics/refined_atomic_abstraction/bad_local_counters/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=64 --num_groups=12 --no-inline 3 | //kernel.cl:9 4 | 5 | __kernel void foo(__local unsigned *localCounter, __global unsigned *globalArray) { 6 | unsigned localIndex = atomic_inc(localCounter); 7 | 8 | // Might race, because localIndex is not necessarily unique between groups 9 | globalArray[localIndex] = get_global_id(0); 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/atomics/refined_atomic_abstraction/check_used_treated_ok/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=12 --no-inline 3 | 4 | __kernel void foo(__global unsigned * c, __global char * g, size_t n) { 5 | volatile int x = __atomic_has_taken_value(c, 0, n); 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/OpenCL/atomics/refined_atomic_abstraction/intra_local_counters/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=12 --no-inline --only-intra-group 3 | 4 | __kernel void foo(__local unsigned *localCounter, __global unsigned *globalArray) { 5 | unsigned localIndex = atomic_inc(localCounter); 6 | 7 | // Might race, because localIndex is not necessarily unique between groups 8 | globalArray[localIndex] = get_global_id(0); 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/OpenCL/atomics/refined_atomic_abstraction/predication/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=64 --num_groups=12 --no-inline 3 | 4 | __kernel void foo(__global unsigned *globalCounter, __global float *globalArray) { 5 | 6 | unsigned globalIndex = 12; 7 | 8 | if(get_global_id(0) != 13) { 9 | globalIndex = atomic_inc(globalCounter); 10 | } 11 | globalArray[globalIndex] = get_global_id(0); 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/barrier_intervals/test1/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=16 --num_groups=16 --debug 3 | //Found 3 barrier interval\(s\) 4 | 5 | #define tid get_local_id(0) 6 | 7 | __kernel void simple_kernel(__local int* p) 8 | { 9 | p[tid] = tid; 10 | barrier(CLK_LOCAL_MEM_FENCE); 11 | p[tid] = tid; 12 | barrier(CLK_LOCAL_MEM_FENCE); 13 | p[tid] = tid; 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/OpenCL/barrier_invariants/fail/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=128 --num_groups=1 --no-inline 3 | //this barrier invariant might not hold 4 | 5 | #define SZ 128 6 | 7 | 8 | __kernel void foo() { 9 | 10 | __local int A[SZ]; 11 | 12 | A[get_local_id(0)] = get_local_id(0); 13 | 14 | __barrier_invariant_1(A[get_local_id(0)] == get_local_id(0) + 1, 0); 15 | barrier(CLK_LOCAL_MEM_FENCE); 16 | 17 | } 18 | 19 | 20 | -------------------------------------------------------------------------------- /testsuite/OpenCL/barrier_invariants/global_array/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=128 --num_groups=1 --no-inline 3 | 4 | __kernel void foo(__global int *A) { 5 | A[get_global_id(0)] = 0; 6 | 7 | __barrier_invariant_1(A[get_global_id(0)] == 0, get_local_id(0)); 8 | barrier(CLK_GLOBAL_MEM_FENCE); 9 | 10 | __assert(A[get_global_id(0)] == 0); 11 | 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /testsuite/OpenCL/barrier_invariants/wrap_around/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=8 --num_groups=1 --no-inline 3 | 4 | #define N 8 5 | 6 | #define tid get_local_id(0) 7 | 8 | __kernel void wrap_around() { 9 | __local int A[N]; 10 | __local int B[N]; 11 | A[tid] = tid; 12 | __barrier_invariant_2(A[tid] == tid, tid, ((tid+1)%N)); 13 | barrier(CLK_LOCAL_MEM_FENCE); 14 | B[A[(tid+1)%N]] = tid; 15 | __assert(B[(tid+1)%N] == tid); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/OpenCL/barrierconditionalkernelparam/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo(int x) { 6 | 7 | if(x == 10) { 8 | barrier(CLK_LOCAL_MEM_FENCE); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/basic1/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | __kernel void foo() { 5 | int a, b, c; 6 | a = 2; 7 | b = 3; 8 | c = a + b; 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/OpenCL/basicbarrier/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo() { 6 | int a, b, c; 7 | a = 2; 8 | b = 3; 9 | c = a + b; 10 | barrier(CLK_LOCAL_MEM_FENCE); 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/basicglobalarray/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=2048 --num_groups=1024 --no-inline 3 | 4 | 5 | 6 | __kernel void foo(__global int* p) { 7 | p[get_global_id(0)] = get_local_id(0); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/benign_race_tests/fail/writeafterread_addition/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=64 --num_groups=1 --equality-abstraction --no-inline 3 | //kernel.cl: error: possible read-write race on 4 | 5 | __kernel void foo(__local int* A) { 6 | int v; 7 | 8 | v = A[0]; 9 | A[0] = v + 1; 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/benign_race_tests/fail/writeafterread_otherval/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=64 --num_groups=1 --equality-abstraction --no-inline 3 | //kernel.cl: error: possible read-write race on 4 | 5 | #define tid get_local_id(0) 6 | 7 | __kernel void foo(__local int* A, __local int* B) { 8 | int v; 9 | 10 | B[tid] = A[0]; 11 | A[0] = 5; 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/benign_race_tests/fail/writereadarray_equality/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=2 --num_groups=1 --equality-abstraction --no-inline 3 | //kernel.cl: error: possible write-read race on 4 | 5 | void foo(int); 6 | 7 | #define tid get_local_id(0) 8 | 9 | __kernel void example(__local int* A) { 10 | A[tid] = 0; 11 | foo(A[tid + 1]); 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/benign_race_tests/fail/writetiddiv64_offbyone/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=65 --num_groups=1 --no-inline 3 | //kernel.cl: error: possible write-write race on 4 | 5 | __kernel void foo(__local int* A, int i) { 6 | A[i] = get_local_id(0) / 64; 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/OpenCL/benign_race_tests/fail/writewritearray_adversarial/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=64 --num_groups=1 --adversarial-abstraction --no-inline 3 | //kernel.cl: error: possible write-write race on 4 | 5 | __kernel void foo(__local int* A, __local int* B, int i, int j) { 6 | A[i] = B[j]; 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/OpenCL/benign_race_tests/fail/writezero_nobenign/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=64 --num_groups=1 --no-benign-tolerance --no-inline 3 | //kernel.cl: error: possible write-write race on 4 | 5 | 6 | __kernel void foo(__local int* A, __local int* B, int i, int j) { 7 | A[0] = 0; 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/benign_race_tests/pass/readafterwrite/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=1 --equality-abstraction --no-inline 3 | 4 | __kernel void foo(__local int* A, __local int* B, int i, int j) { 5 | __requires(i >= 0); 6 | __requires(j >= 0); 7 | A[i] = i; 8 | B[j] = A[j]; 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/OpenCL/benign_race_tests/pass/writeafterread/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=1 --equality-abstraction --no-inline 3 | 4 | __kernel void foo(__local int* A) { 5 | int v; 6 | 7 | v = A[0]; 8 | A[0] = v; 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/OpenCL/benign_race_tests/pass/writeinloop/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 3 | 4 | __kernel void foo(__local int* A, int start, int end) { 5 | for (unsigned i = start; i < end; ++i) { 6 | A[0] = 42; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/benign_race_tests/pass/writetiddiv64/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | __kernel void foo(__local int* A, int i) { 5 | __requires(i >= 0); 6 | A[i] = get_local_id(0) / 64; 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/OpenCL/benign_race_tests/pass/writewritearray/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --equality-abstraction --no-inline 3 | 4 | __kernel void foo(__local int* A, __local int* B, int i, int j) { 5 | __requires(i >= 0); 6 | __requires(j >= 0); 7 | A[i] = B[j]; 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/benign_race_tests/pass/writezero/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | __kernel void foo(__local int* A, __local int* B, int i, int j) { 5 | A[0] = 0; 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/OpenCL/bitand/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo() { 6 | int x, y, z; 7 | x = 0; 8 | y = 1; 9 | z = x & y; 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/bitnot/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo() { 6 | int x, y; 7 | x = 2; 8 | y = ~x; 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/OpenCL/bitor/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo() { 6 | int x, y, z; 7 | x = 0; 8 | y = 1; 9 | z = x | y; 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/bitxor/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo() { 6 | int x, y, z; 7 | x = 0; 8 | y = 1; 9 | z = x ^ y; 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/bool_bv_test/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo(int j) 6 | { 7 | int x = (bool)j ? 1 : 0; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /testsuite/OpenCL/booleanTests/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --clang-opt=-Wno-tautological-compare --no-inline 3 | 4 | bool bar(void); 5 | 6 | int baz(void); 7 | 8 | __kernel void foo() { 9 | bool y = bar(); 10 | int x = baz(); 11 | 12 | x = !x; 13 | y = !y; 14 | 15 | if(x){} 16 | if(!x){} 17 | if(y){} 18 | if(!y){} 19 | if(x < x){} 20 | if(!(x < x)){} 21 | 22 | } 23 | -------------------------------------------------------------------------------- /testsuite/OpenCL/bpl_integration/pass/axioms.bpl: -------------------------------------------------------------------------------- 1 | axiom (forall x, y : bv32 :: f(x, y) == g(x, y)); 2 | -------------------------------------------------------------------------------- /testsuite/OpenCL/bpl_integration/pass/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=2 --num_groups=2 --boogie-file=${KERNEL_DIR}/axioms.bpl --no-inline 3 | 4 | DECLARE_UF_BINARY(f, int, int, int); 5 | DECLARE_UF_BINARY(g, int, int, int); 6 | 7 | __kernel void foo(int a, int b) { 8 | 9 | __assert(f(a, b) == g(a, b)); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/break_test/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo(int x) 6 | { 7 | while (x + 100 < 102) { 8 | if(get_local_id(0) < 5) { 9 | x = 2; 10 | break; 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/OpenCL/casttofloat/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | __kernel void foo() { 4 | 5 | float x = (float)2; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/OpenCL/ceil/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1 3 | 4 | __kernel void test(__global float4 *io) 5 | { 6 | io[get_local_id(0)] = ceil(io[get_local_id(0)]); 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/OpenCL/checkarrays/fail/arraydoesnotexist1/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:GPUVERIFYVCGEN_ERROR 2 | //--local_size=256 --num_groups=2 --vcgen-opt=/checkArrays:AB 3 | //Array name 'AB' specified for restricted checking is not found 4 | 5 | kernel void foo(global int * A) { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/OpenCL/checkarrays/fail/arraydoesnotexist2/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:GPUVERIFYVCGEN_ERROR 2 | //--local_size=256 --num_groups=2 --vcgen-opt=/checkArrays:A,AB,B 3 | //Array name 'AB' specified for restricted checking is not found 4 | 5 | kernel void foo(global int * A, global int * B) { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/OpenCL/checkarrays/pass/specifyall/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=256 --num_groups=2 --vcgen-opt=/checkArrays:A,B,C 3 | 4 | kernel void foo(global int * A, global int * B) { 5 | local int C[256]; 6 | 7 | A[get_global_id(0)] = B[get_global_id(0)]; 8 | C[get_local_id(0)] = A[get_global_id(0)]; 9 | B[get_global_id(0)] += C[get_local_id(0)]; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/checkarrays/pass/specifyone/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=256 --num_groups=2 --vcgen-opt=/checkArrays:B 3 | 4 | kernel void foo(global int * A, global int * B) { 5 | local int C[256]; 6 | 7 | A[get_global_id(0) + 1] = B[get_global_id(0)]; 8 | C[0] = A[get_global_id(0)]; 9 | B[get_global_id(0)] += A[get_global_id(0)]; 10 | __assert(__no_write(A)); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/conditional_int_test/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | __kernel void foo(int x, int y) { 4 | 5 | if(x) { 6 | 7 | } else if(x == y) { 8 | 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/constantnotparam/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | 6 | __constant sampler_t imageSampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST; 7 | 8 | __kernel void foo(__read_only image2d_t matrixA) { 9 | 10 | float4 tempA0 = read_imagef(matrixA, imageSampler, (int2)(1)); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/derived_from_uniformity_analysis_bug/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo(__global int* A) 6 | { 7 | for(int i = get_local_id(0); i < 100; i++) { } 8 | 9 | for(int j = 100; j > 0; j--) { } 10 | 11 | } 12 | 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/divergence/race_and_divergence/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=1024 --global_size=1024 --only-divergence 3 | //barrier may be reached by non-uniform control flow 4 | 5 | kernel void foo (global int * restrict A, global int * restrict B) { 6 | int tmp = A[get_global_id(0)]; 7 | if (tmp == 0) { 8 | barrier(CLK_GLOBAL_MEM_FENCE); 9 | } 10 | B[0] = tmp; 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/divergence/race_no_divergence/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --global_size=1024 --only-divergence 3 | 4 | kernel void foo (global int * restrict A, global int * restrict B) { 5 | int tmp = A[get_global_id(0)]; 6 | barrier(CLK_GLOBAL_MEM_FENCE); 7 | B[0] = tmp; 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/enabled/not_predicated/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=16 --num_groups=1 --no-inline 3 | 4 | __kernel void foo(__global int* A) { 5 | __assert(__enabled()); 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/OpenCL/enabled/not_predicated_procedure/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=16 --num_groups=1 --no-inline 3 | 4 | void bar(__global int *A) { 5 | __requires(__enabled()); 6 | } 7 | 8 | __kernel void foo(__global int* A) { 9 | bar(A); 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/fail_bodiless_procedure/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=64 --num_groups=64 --no-inline 3 | //kernel.cl:10:3:[\s]+error:[\s]+this assertion might not hold for work item 4 | 5 | unsigned bar(unsigned, unsigned); 6 | 7 | __kernel void foo(unsigned x, unsigned y) { 8 | unsigned z; 9 | z = bar(x, y); 10 | __assert(z >= x && z >= y); 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/fail_equality_and_adversarial/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:COMMAND_LINE_ERROR 2 | //--local_size=2 --num_groups=2 --equality-abstraction --adversarial-abstraction --no-inline 3 | 4 | __kernel void foo() { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/OpenCL/float_constant_test/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=[64,64] --num_groups=[64,64] --no-inline 3 | 4 | float bar(void); 5 | 6 | __kernel void foo() 7 | { 8 | float f = bar(); 9 | f = (float)2 - f; 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/float_constant_test2/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=[64,64] --num_groups=[64,64] --no-inline 3 | 4 | __kernel void foo() 5 | { 6 | float fval = (float)2; 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/OpenCL/floatcastrequired/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo() { 6 | 7 | float x = 2; 8 | x = exp(x); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/floatrelationalop/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | __kernel void foo() { 4 | 5 | float x = 2.0f; 6 | float y = 2.0f; 7 | 8 | if(x < y) { 9 | 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/fresh_arrays/fail/global/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=2048 --num_groups=64 3 | //possible write-write race on q\[\d+\] 4 | 5 | __kernel void foo(__global float * q) { 6 | __requires_fresh_array(q); 7 | q[get_local_id(0)] = get_global_id(0); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/fresh_arrays/pass/global/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=2048 --num_groups=64 3 | 4 | __kernel void foo(__global float * q) { 5 | __requires_fresh_array(q); 6 | q[get_global_id(0)] = get_global_id(0); 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/OpenCL/fresh_arrays/pass/local/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=2048 --num_groups=64 3 | 4 | __kernel void foo(__local float * q) { 5 | __requires_fresh_array(q); 6 | q[get_local_id(0)] = get_local_id(0); 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/OpenCL/function_wide/fail/assert_false/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--no-infer --local_size=1024 --num_groups=2 3 | 4 | kernel void foo(unsigned i, unsigned j, unsigned x) { 5 | 6 | __assert(false); 7 | 8 | __function_wide_invariant(false); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/function_wide/fail/not_at_end_for/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:BUGLE_ERROR 2 | //--no-infer --local_size=1024 --num_groups=2 3 | 4 | kernel void foo(unsigned i) { 5 | __function_wide_invariant((i % 2) == 0); 6 | for(int j = 0; j < 100; j += 2) { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/function_wide/fail/not_at_end_if/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:BUGLE_ERROR 2 | //--no-infer --local_size=1024 --num_groups=2 3 | 4 | kernel void foo(unsigned i, __global int *A) { 5 | __function_wide_invariant((i % 2) == 0); 6 | if (i > 10) { 7 | A[get_global_id(0)] = i; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/OpenCL/function_wide/fail/uses_function/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:BUGLE_ERROR 2 | //--no-infer --local_size=1024 --num_groups=2 --no-inline 3 | 4 | bool bar() { 5 | return true; 6 | } 7 | 8 | kernel void foo() { 9 | __function_wide_invariant(bar()); 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/function_wide/fail/uses_params/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:BUGLE_ERROR 2 | //--no-infer --local_size=1024 --num_groups=2 3 | 4 | kernel void foo(unsigned i) { 5 | for(i = 0; i < 100; i += 2) { 6 | } 7 | 8 | __function_wide_invariant((i % 2) == 0); 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/OpenCL/function_wide/pass/uses_array_element/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--equality-abstraction --local_size=1024 --num_groups=2 3 | 4 | kernel void foo(__global unsigned *A) { 5 | A[get_global_id(0)] = 1; 6 | 7 | for (int i = 0; i < 1024; ++i) { 8 | A[get_global_id(0)] = 1; 9 | } 10 | 11 | __assert(A[get_global_id(0)] == 1); 12 | 13 | __function_wide_invariant(A[get_global_id(0)] == 1); 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/OpenCL/function_wide/pass/uses_uninterpreted_function/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--no-infer --local_size=1024 --num_groups=2 3 | 4 | bool __uninterpreted_function_bar(void); 5 | 6 | kernel void foo() { 7 | __function_wide_invariant(__uninterpreted_function_bar()); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/get_global_id/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=512 --num_groups=256 --no-inline 3 | 4 | 5 | 6 | __kernel void foo(__global float* A) { 7 | A[get_global_id(0)] = A[get_global_id(0)] + 1.0f; 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/get_global_offset/kernel.cl: -------------------------------------------------------------------------------- 1 | //PASS 2 | //--local_size=64 --num_groups=64 --global_offset=64 3 | 4 | __kernel void foo() { 5 | __assert(get_global_id(0) >= 64); 6 | __assert(get_global_offset(0) == 64); 7 | __assert(get_global_offset(1) == 0); 8 | __assert(get_global_offset(2) == 0); 9 | } 10 | 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/get_work_dim/work_dim_1/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=512 --num_groups=256 3 | 4 | __kernel void test() { 5 | __assert(get_work_dim() == 1); 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/OpenCL/get_work_dim/work_dim_2/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=512,512 --num_groups=256,256 3 | 4 | __kernel void test() { 5 | __assert(get_work_dim() == 2); 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/OpenCL/get_work_dim/work_dim_3/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=512,512,512 --num_groups=256,256,256 3 | 4 | __kernel void test() { 5 | __assert(get_work_dim() == 3); 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/OpenCL/global_size/local_size_fail_divide_global_size/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:COMMAND_LINE_ERROR 2 | //--local_size=[32,64] --global_size=[64,127] 3 | //Dimension 1 of global size does not divide by dimension 1 of local size 4 | 5 | void __kernel a(__global int* A) 6 | { 7 | A[get_global_id(0)] += 5; 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/global_size/mismatch_dims/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:COMMAND_LINE_ERROR 2 | //--local_size=[32,64] --global_size=[64] 3 | //Dimensions of local and global size must match 4 | 5 | void __kernel a(__global int* A) 6 | { 7 | A[get_global_id(0)] += 5; 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/global_size/num_groups_and_global_size/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:COMMAND_LINE_ERROR 2 | //--local_size=[32,64] --global_size=[64,64] --num_groups=[2,1] 3 | //--num_groups=: not allowed with argument --global_size= 4 | 5 | void __kernel a(__global int* A) 6 | { 7 | A[get_global_id(0)] += 5; 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/global_size/simple/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=[32,64] --global_size=[64,256] 3 | 4 | void __kernel a(__global int* A) 5 | { 6 | __assert( get_global_size(0) == 64); 7 | __assert( get_global_size(1) == 256); 8 | __assert( get_num_groups(0) == 2); 9 | __assert( get_num_groups(1) == 4); 10 | A[get_global_id(0) + get_global_id(1)*get_global_size(0)] +=5; 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/globalarray/pass/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=8 --num_groups=8 --no-inline 3 | 4 | 5 | __constant int A[64] = { }; 6 | 7 | __kernel void globalarray(__global float* p) { 8 | int i = get_global_id(0); 9 | int a = A[i]; 10 | 11 | if(a != 0) { 12 | p[0] = get_global_id(0); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/OpenCL/imagetests/testsampler/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--num_groups=[16,32] --local_size=[16,8] 3 | 4 | __kernel void foo(__read_only image2d_t img, sampler_t samp) 5 | { 6 | int2 idx = (int2)(get_global_id(0), get_global_id(1)); 7 | float4 x = read_imagef(img, samp, idx); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/imagetests/testsampler2/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--num_groups=[16,32] --local_size=[16,8] 3 | 4 | const sampler_t samp = CLK_NORMALIZED_COORDS_TRUE 5 | | CLK_ADDRESS_REPEAT 6 | | CLK_FILTER_NEAREST; 7 | 8 | __kernel void foo(__read_only image2d_t img) 9 | { 10 | int2 idx = (int2)(get_global_id(0), get_global_id(1)); 11 | float4 x = read_imagef(img, samp, idx); 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/induction_variable/kernel.cl: -------------------------------------------------------------------------------- 1 | //PASS 2 | //--local_size=1024 --num_groups=2 3 | 4 | __kernel void foo(__local int *data) 5 | { 6 | int j = 0; 7 | for (int i = 0; i <10; i++, j += get_local_size(0)) { 8 | data[j + get_local_id(0)] = get_local_id(0); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/inference_tests/lower_bound/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=32 --num_groups=32 3 | 4 | __kernel void foo(int x, int y, int z) 5 | { 6 | for (int i = 0; i < (x ? y : z); i++) { 7 | __assert(i >= 0); 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/inference_tests/strided_invariant/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1024 --no-inline 3 | 4 | __kernel void example(__local int * A) { 5 | 6 | for(unsigned i = 0; i < 100; i++) { 7 | for(unsigned j = 0; j < (1 << 16); j += 16) { 8 | __assert((j % 16) == 0); 9 | } 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/inter_group_and_barrier_flag_tests/pass/global_barrier/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1024 --no-inline 3 | 4 | 5 | __kernel void foo(__global int* p) { 6 | 7 | p[get_global_id(0)] = get_global_id(0); 8 | 9 | barrier(CLK_GLOBAL_MEM_FENCE); 10 | 11 | if(get_local_id(0) < get_local_size(0) - 1) { 12 | p[get_global_id(0) + 1] = get_global_id(0); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/OpenCL/inter_group_and_barrier_flag_tests/pass/local_barrier_flag/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1024 --no-inline 3 | 4 | 5 | __kernel void foo(__local int* p) { 6 | 7 | p[get_local_id(0)] = get_global_id(0); 8 | 9 | barrier(CLK_LOCAL_MEM_FENCE); 10 | 11 | p[get_local_id(0) + 1] = get_global_id(0); 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/inter_group_and_barrier_flag_tests/pass/local_id_benign_write_write/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1024 --equality-abstraction --no-inline 3 | 4 | 5 | __kernel void foo(__global int* p) { 6 | 7 | p[get_local_id(0)] = get_local_id(0); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/OpenCL/inter_group_and_barrier_flag_tests/pass/pass_due_to_intra_group_flag/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1024 --only-intra-group --no-inline 3 | 4 | 5 | __kernel void foo(__global int* p) { 6 | 7 | // There would be an inter-group race; this test 8 | // checks that the flag to check only intra-group 9 | // races is working 10 | p[get_local_id(0)] = get_global_id(0); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/inter_group_and_barrier_flag_tests/pass/read_then_write/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1024 --no-inline 3 | 4 | 5 | __kernel void foo(__local int* p) { 6 | 7 | volatile int x, y; 8 | 9 | x = get_local_id(0) == 0 ? CLK_LOCAL_MEM_FENCE : 0; 10 | 11 | if(get_local_id(0) == 0) { 12 | y = p[0]; 13 | } 14 | 15 | barrier(x); 16 | 17 | if(get_local_id(0) == 1) { 18 | p[0] = 0; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /testsuite/OpenCL/inter_group_and_barrier_flag_tests/pass/sync_within_group/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1024 --no-inline 3 | 4 | 5 | __kernel void foo(__global int* p) { 6 | p[get_global_id(0)] = get_global_id(0); 7 | 8 | barrier(CLK_GLOBAL_MEM_FENCE); 9 | 10 | if(get_local_id(0) < get_local_size(0) - 1) { 11 | p[get_global_id(0) + 1] = get_global_id(0); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/OpenCL/k-induction/alldifferent/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=24 --no-infer --k-induction-depth=3 3 | 4 | __kernel void foo(int a, int b, int c) { 5 | __requires(a != b); 6 | __requires(a != c); 7 | __requires(b != c); 8 | 9 | for(int i = 0; __invariant(a != b), i < 100; i++) { 10 | int temp = a; 11 | a = b; 12 | b = c; 13 | c = temp; 14 | } 15 | __assert(a != b); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/OpenCL/leftshiftequals/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | __kernel void foo() { 5 | unsigned int x = 1; 6 | signed int y = 2; 7 | 8 | x <<= x; 9 | y <<= x; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/localarrayaccess/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo() { 6 | 7 | __local int A[65]; 8 | 9 | A[get_local_id(0)] = 2; 10 | 11 | barrier(CLK_LOCAL_MEM_FENCE); 12 | 13 | int x = A[get_local_id(0) + 1]; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /testsuite/OpenCL/localmultidimarraydecl/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo() { 6 | 7 | __local float a[10][10][10][10][10]; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/OpenCL/mem_fence/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=24 3 | 4 | __kernel void foo() { 5 | mem_fence(CLK_LOCAL_MEM_FENCE & CLK_GLOBAL_MEM_FENCE); 6 | read_mem_fence(CLK_LOCAL_MEM_FENCE & CLK_GLOBAL_MEM_FENCE); 7 | write_mem_fence(CLK_LOCAL_MEM_FENCE & CLK_GLOBAL_MEM_FENCE); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/misc/fail/4d_array_of_vectors_race/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=[64,64] --global_size=[256,256] 3 | //kernel.cl: error: possible write-write race on L\[1\]\[2\]\[3\]\[3\] \(bytes 8..11\) 4 | 5 | kernel void example(global float4 *G) { 6 | local float4 L[2][3][4][5]; 7 | 8 | L[1][2][3][3].z = G[get_global_id(0)].x; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/misc/fail/4d_array_race/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=[64,64] --global_size=[256,256] 3 | //kernel.cl: error: possible write-write race on L\[1\]\[2\]\[3\]\[3\] 4 | 5 | kernel void example(global int *G) { 6 | local int L[2][3][4][5]; 7 | 8 | L[1][2][3][3] = G[get_global_id(0)]; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/misc/fail/miscfail1/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=1024 --num_groups=1 --no-inline 3 | 4 | 5 | 6 | #define tid get_local_id(0) 7 | __kernel void foo(__local int* A, __local int* B, __local int *C) { 8 | C[tid] = C[tid + 1]; 9 | B[tid] = A[C[tid + 2]]; 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/misc/fail/miscfail10/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=64 --num_groups=64 3 | //race 4 | 5 | __kernel void foo(__global uint *h1, __global uint *h2, int i) 6 | { 7 | __global uint *h = i > 0 ? h1 : h2; 8 | 9 | __local uint l[256]; 10 | 11 | for(uint i = 0; i < 256; i += 1) 12 | { 13 | h[i] += l[i]; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /testsuite/OpenCL/misc/fail/miscfail11/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--num_groups=1 --local_size=64 --cruncher-opt=/replaceLoopInvariantAssertions 3 | 4 | __kernel void 5 | foo(__global int* A, __global int* fail) 6 | { 7 | for (int i = 0; 8 | __invariant(i == 5), 9 | i < 8; i++) { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/misc/fail/miscfail2/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:CLANG_ERROR 2 | //--local_size=4 --num_groups=2 --no-inline 3 | //kernel.cl:6:3:[\s]+error: implicit declaration of function 'foo' is invalid 4 | 5 | __kernel void k() { 6 | foo(); 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/OpenCL/misc/fail/miscfail4/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:CLANG_ERROR 2 | //--local_size=16 --num_groups=1 --no-inline 3 | 4 | __kernel void foo(__constant int* A) { 5 | 6 | A[get_local_id(0)] = get_local_id(0); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/misc/fail/miscfail5/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--num_groups=1024 --local_size=1024 --no-inline 3 | //assert\(c.x == 2\) 4 | __kernel void foo() 5 | { 6 | volatile int4 a = (int4)(1, 2, 3, 0); 7 | volatile int4 b = (int4)(2, 3, 4, 1); 8 | int4 c = min(a, b); 9 | __assert(c.x == 2); 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/misc/fail/miscfail7/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=1024 --num_groups=1024 --no-inline 3 | //error: this assertion might not hold for work item 4 | 5 | __kernel void foo() 6 | { 7 | int z = 0; 8 | int j = ((z < 4) ? 3 : z); 9 | 10 | if(get_local_id(0)) 11 | __assert(false); 12 | else 13 | __assert(false); 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/OpenCL/misc/fail/miscfail9/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=1024 --num_groups=1024 3 | //sincos 4 | 5 | __kernel void test(__global float * A) { 6 | sincos(get_global_id(0), A); 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/OpenCL/misc/fail/struct_member_race/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=64 --global_size=256 3 | //kernel.cl: error: possible write-write race on G\[3\] \(bytes 4..7\) 4 | 5 | typedef struct { 6 | int x; 7 | int y; 8 | } S; 9 | 10 | kernel void example(global S *G) { 11 | 12 | G[3].y = get_global_id(0); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/OpenCL/misc/fail/vector_element_race/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=64 --global_size=256 3 | //kernel.cl: error: possible write-write race on G\[3\] \(bytes 4..7\) 4 | 5 | kernel void example(global float4 *G) { 6 | 7 | G[3].y = (float)get_global_id(0); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/OpenCL/misc/pass/misc1/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1 --no-inline 3 | 4 | #define tid get_local_id(0) 5 | #define N get_local_size(0) 6 | 7 | __kernel void add_neighbour(__local int * A, int offset) { 8 | __requires(offset >= 0 & offset > N & offset < 1000000); 9 | 10 | __assume(tid < 10); 11 | 12 | A[tid] = A[tid] + A[tid + offset]; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/OpenCL/misc/pass/misc10/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=16 --num_groups=16 --no-inline 3 | 4 | __kernel void foo(__local int* p, __local int* q, int x) { 5 | __local int * r; 6 | 7 | r = x ? p : q; 8 | 9 | volatile int z = __read_offset_bytes(r); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/misc/pass/misc11/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=128 --num_groups=128 --no-inline 3 | 4 | __kernel void foo(__local int *A) { 5 | 6 | __requires(A[get_local_id(0)] == 0); 7 | 8 | barrier(CLK_LOCAL_MEM_FENCE); 9 | 10 | __assert(A[get_local_id(0)] == 0); 11 | 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /testsuite/OpenCL/misc/pass/misc12/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--no-infer --local_size=16 --num_groups=16 3 | 4 | kernel void foo() { 5 | 6 | for(int i = 0; i < get_group_id(0); i++) { 7 | barrier(CLK_LOCAL_MEM_FENCE); 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/misc/pass/misc13/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--no-infer --local_size=16 --num_groups=16 3 | 4 | kernel void foo(__global int* B) { 5 | 6 | int A[] = { 1 }; 7 | 8 | B[get_global_id(0)] = A[0]; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/misc/pass/misc14/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=10 --num_groups=1 --no-inline 3 | 4 | int bar(int *x) { 5 | __requires(x[get_global_id(0)] < 10); 6 | return x[get_global_id(0)]; 7 | } 8 | 9 | __kernel void foo(__global int* A) { 10 | int x[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; 11 | A[get_global_id(0)] = bar(x); 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/misc/pass/misc15/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=2 --num_groups=1 --kernel-args=foo,0x00000003 3 | 4 | kernel void foo (local int* A, int x) { 5 | if (x == 3) { 6 | A[get_local_id(0)] = 3; 7 | } 8 | else { 9 | A[0] = get_local_id(0); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/misc/pass/misc16/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | #pragma OPENCL EXTENSION cl_khr_fp64 : enable 5 | 6 | __kernel void foo(__global float4* p, 7 | __global int4* n) 8 | { 9 | p[get_global_id(0)] = pown(p[get_global_id(0)], n[get_global_id(0)]); 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/misc/pass/misc17/kernel.cl: -------------------------------------------------------------------------------- 1 | //PASS 2 | //--local_size=2 --num_groups=2 3 | 4 | #define __max(X, Y) ((X) > (Y) ? (X) : Y) 5 | 6 | kernel void foo(int x) { 7 | 8 | for(int i = __max(0, -32*x); i < 100; i++) { 9 | __assert(i >= __max(0, -32*x)); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/misc/pass/misc19/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=2 --num_groups=1 --kernel-args=foo,0x0000000300000003 3 | 4 | struct pack { 5 | int a; 6 | int b; 7 | }; 8 | 9 | kernel void foo (struct pack x) { 10 | __assert(x.a == 3); 11 | __assert(x.b == 3); 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/misc/pass/misc3/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1024 --no-inline 3 | 4 | void f2(__global int *a) 5 | { 6 | } 7 | 8 | void f1(__global int *a){ 9 | f2(a); 10 | } 11 | 12 | __kernel 13 | void k(__global int *a) 14 | { 15 | if (get_local_id(0)) { 16 | f1(a); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/OpenCL/misc/pass/misc4/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--num_groups=1024 --local_size=1024 --no-inline 3 | 4 | __kernel void foo(float3 x, float3 y) 5 | { 6 | float3 temp = fmin(x,y); 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/OpenCL/misc/pass/misc5/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--num_groups=1024 --local_size=1024 --no-inline 3 | 4 | __kernel void foo() 5 | { 6 | volatile int4 a = (int4)(1, 2, 3, 0); 7 | volatile int4 b = (int4)(2, 3, 4, 1); 8 | int4 c = min(a, b); 9 | __assert(c.x == 1); 10 | __assert(c.y == 2); 11 | __assert(c.z == 3); 12 | __assert(c.w == 0); 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/OpenCL/misc/pass/misc8/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1024 --no-inline 3 | 4 | float baz(float p) 5 | { 6 | return half_powr(2.0f, p); 7 | } 8 | 9 | __kernel void foo(__global float *A) 10 | { 11 | if(A[get_global_id(0)]) 12 | baz(2.0f); 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/OpenCL/misc/pass/misc9/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=16 --num_groups=16 --no-inline 3 | 4 | void baz(int); 5 | 6 | __kernel void foo(__local int* p, __local int* q, int x) { 7 | __local int * r; 8 | 9 | r = x ? p : q; 10 | 11 | baz(__read_offset_bytes(r)); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/OpenCL/modifyparam/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | 6 | __kernel 7 | void foo(int a) 8 | { 9 | a = 5; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/multidimarrays/test1/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | __kernel void foo() { 4 | 5 | __local int A[10][5]; 6 | 7 | int x = A[3][4]; // We should generate A + 10*3 + 4 8 | 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/OpenCL/multidimarrays/test2/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=[32,32] --num_groups=8 --no-inline 3 | 4 | 5 | 6 | 7 | 8 | __kernel void foo() { 9 | 10 | __local int A[32][32]; 11 | 12 | A[get_local_id(1)][get_local_id(0)] = 2; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/OpenCL/multidimarrays/test3/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | __kernel void foo() { 4 | 5 | __local int A[100][99][98]; 6 | 7 | int x = A[5][4][3]; // We should generate A + 99*(100*5 + 4) + 3 8 | 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/OpenCL/multidimarrays/test4/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=[64,64,64] --num_groups=[64,64,64] --no-inline 3 | 4 | 5 | 6 | __kernel void foo() { 7 | 8 | __local float A[64][64][64]; 9 | 10 | A[get_local_id(2)][get_local_id(1)][get_local_id(0)] = get_local_id(0); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/multidimarrays/test5/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --equality-abstraction --no-inline 3 | __kernel void foo(__global unsigned int* A) 4 | { 5 | A[0] = 0; 6 | 7 | int x = A[0]; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /testsuite/OpenCL/multiplelocals/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | void bar(int x) 6 | { 7 | int bar = x; 8 | } 9 | 10 | void baz(int y) 11 | { 12 | int foo = y; 13 | } 14 | 15 | __kernel void foo(float x) { 16 | { 17 | int x = 4, y=2; 18 | x++; 19 | x++; 20 | y++; 21 | y++; 22 | } 23 | { 24 | int x = 2; 25 | int foo = 2; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /testsuite/OpenCL/multiplelocals2/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | __kernel void foo() 5 | { 6 | for(int i=0; i < 2; i++) 7 | { 8 | i++; 9 | } 10 | 11 | for(int i=0; i < 2; i++) 12 | { 13 | i++; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/OpenCL/no_log/fail/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=16 --num_groups=1 --only-log --no-inline 3 | //kernel.cl:7:[\d]+: error: this assertion might not hold 4 | 5 | __kernel void foo(__local int* A) { 6 | A[get_local_id(0)] = get_local_id(0); 7 | __assert(!__write(A)); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/no_log/pass/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=16 --num_groups=1 --only-log --no-inline 3 | 4 | __kernel void foo(__local int* A) { 5 | // Causes a race, but with --only-log this is not reported 6 | A[0] = get_local_id(0); 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/OpenCL/nonterminating/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=256 --no-inline 3 | 4 | __kernel void foo() { 5 | while(true) { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/OpenCL/noraceduetoreturn/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | int bar(__local float* A) 6 | { 7 | 8 | if(get_local_id(0) != 0) { 9 | return 0; 10 | } 11 | 12 | A[4] = 26.8f; 13 | 14 | return 1; 15 | 16 | } 17 | 18 | __kernel void foo(__local float* A) { 19 | 20 | int y = bar(A); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /testsuite/OpenCL/notunaryoptest/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo() { 6 | 7 | int x = 1; 8 | 9 | x = !x; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/notunaryoptest2/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | bool bar(void); 5 | 6 | __kernel void foo() { 7 | 8 | bool x = bar(); 9 | 10 | x = !x; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/null_pointers/atomic_null/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=1024 --num_groups=1 --no-inline 3 | //error: possible null pointer access for work item 4 | 5 | kernel void foo() 6 | { 7 | atomic_inc((__global int*)0); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/null_pointers/function_prototype/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=1024 --num_groups=1024 --no-inline 3 | //error: possible null pointer access for work item 4 | 5 | float* bar(float* p); 6 | 7 | __kernel void foo() 8 | { 9 | float x = 0; 10 | float *y = bar(&x); 11 | y[0] = y[0] + 1; 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/null_pointers/function_prototype_or_local/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=1024 --num_groups=1024 --no-inline 3 | //error: possible null pointer access for work item 4 | 5 | float* bar(float* p); 6 | 7 | __kernel void foo(int i) 8 | { 9 | float x = 0; 10 | float z = 0; 11 | float *y; 12 | 13 | if (i == 0) 14 | y = bar(&x); 15 | else 16 | y = &z; 17 | 18 | y[0] = y[0] + 1; 19 | } 20 | -------------------------------------------------------------------------------- /testsuite/OpenCL/null_pointers/load_from_null/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=1024 --num_groups=1024 --no-inline 3 | //error: possible null pointer access for work item 4 | 5 | __kernel void foo(__global int *b) 6 | { 7 | __global int *a = 0; 8 | int x = a[get_global_id(0)]; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/null_pointers/non_null_pointer_assignment_2/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1024 --no-inline 3 | 4 | __kernel void foo(int i) 5 | { 6 | float x = 0; 7 | float z = 0; 8 | float *y; 9 | 10 | if (i) 11 | y = &x; 12 | else 13 | y = &z; 14 | 15 | 16 | y[0] = y[0] + 1; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /testsuite/OpenCL/null_pointers/null_pointer_assignment/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=1024 --num_groups=1024 --no-inline 3 | //error: possible null pointer access for work item 4 | 5 | __kernel void foo(int i) 6 | { 7 | float x = 0; 8 | float *y; 9 | 10 | if (i) 11 | y = &x; 12 | else 13 | y = 0; 14 | 15 | 16 | y[0] = y[0] + 1; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /testsuite/OpenCL/null_pointers/null_pointer_assignment_function/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=1024 --num_groups=1024 --no-inline 3 | //error: possible null pointer access for work item 4 | 5 | float* bar(float* p, int i) 6 | { 7 | if (i) 8 | return p; 9 | else 10 | return NULL; 11 | } 12 | 13 | __kernel void foo(int i) 14 | { 15 | float x = 0; 16 | float *y = bar(&x, i); 17 | y[0] = y[0] + 1; 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/OpenCL/null_pointers/null_pointer_choice/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=2 --num_groups=2 --no-inline 3 | //possible null pointer access 4 | 5 | __kernel void testKernel() { 6 | char *bufptr, *next; 7 | 8 | next = NULL; 9 | bufptr = next + 5; 10 | 11 | if (bufptr >= 0) 12 | bufptr = NULL; 13 | 14 | bufptr = bufptr; 15 | 16 | bufptr[5] = 'a'; 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/OpenCL/null_pointers/null_pointer_use_in_function/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=1024 --num_groups=1024 --no-inline 3 | //error: possible null pointer access for work item 4 | 5 | float* bar(float* p) 6 | { 7 | p[0] += 1; 8 | return p; 9 | } 10 | 11 | __kernel void foo(int i) 12 | { 13 | float x = 0; 14 | float *y; 15 | 16 | if (i == 0) 17 | y = bar(0); 18 | else 19 | y = bar(&x); 20 | 21 | x += 1; 22 | } 23 | -------------------------------------------------------------------------------- /testsuite/OpenCL/null_pointers/store_to_null_and_non_null/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=1024 --num_groups=1024 --no-inline 3 | //error: possible null pointer access for work item 4 | 5 | __kernel void foo(__global int *A) 6 | { 7 | __global int *a = NULL; 8 | 9 | a[get_global_id(0)] = get_global_id(0); 10 | A[get_global_id(0)] = get_global_id(0); 11 | } 12 | 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/null_statement/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo() 6 | { 7 | ; 8 | ; 9 | ; 10 | ; 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/pointeranalysistests/testbasicpointerarithmetic/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=256 --num_groups=128 --no-inline 3 | 4 | 5 | __kernel void foo(__global float* p, __global float* q) 6 | { 7 | 8 | __global float* pAlias; 9 | 10 | pAlias = p + 10; 11 | 12 | for(int i = 0; i < 100; i++) { 13 | pAlias[get_global_id(0)] = pAlias[get_global_id(0)] + 1.0f; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/OpenCL/pointeranalysistests/testbasicpointerarithmetic2/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=8192 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo(__local float* p, __local float* q) 6 | { 7 | 8 | __local float* pAlias; 9 | 10 | pAlias = p + 10; 11 | 12 | for(int i = 0; i < 100; i++) { 13 | pAlias[get_local_id(0)] = pAlias[get_local_id(0)] + 1.0f; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/OpenCL/pointertests/param_addressof/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | void baz(int * a) 6 | { 7 | *a = 1; 8 | } 9 | 10 | void bar() 11 | { 12 | int * f; 13 | int g; 14 | 15 | f = &g; 16 | 17 | baz(&g); 18 | baz(f); 19 | 20 | if(g == 1 && *f == 1) 21 | { 22 | //blah 23 | } 24 | 25 | } 26 | 27 | __kernel void foo(__global int* A, uint me) 28 | { 29 | bar(); 30 | } 31 | 32 | -------------------------------------------------------------------------------- /testsuite/OpenCL/pointertests/pointerarith/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo(__global int* A, uint me) 6 | { 7 | __global int* q; 8 | 9 | q = A + (me + (me >> 5)); 10 | 11 | } 12 | 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/pointertests/test_copy_between_memory_spaces/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo(__global float* A) 6 | { 7 | __local float B[10]; 8 | int x; 9 | 10 | if(B[0] > 0) 11 | { 12 | x = 1; 13 | } 14 | 15 | barrier(CLK_LOCAL_MEM_FENCE); 16 | 17 | if(A[0] > 0) 18 | { 19 | B[0] = A[0]; 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /testsuite/OpenCL/pointertests/test_copy_between_memory_spaces2/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo(__global float* A, __local float* B) 6 | { 7 | 8 | int x; 9 | 10 | if(B[0] < A[0]) 11 | { 12 | x = 1; 13 | } 14 | 15 | barrier(CLK_LOCAL_MEM_FENCE); 16 | 17 | if(A[0] > 0) 18 | { 19 | B[0] = A[0]; 20 | } 21 | 22 | } 23 | 24 | -------------------------------------------------------------------------------- /testsuite/OpenCL/pointertests/test_dereference_address_of/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo() 6 | { 7 | int x; 8 | 9 | *&x = 5; 10 | 11 | __assert(x == 5); 12 | 13 | } 14 | 15 | -------------------------------------------------------------------------------- /testsuite/OpenCL/pointertests/test_opencl_local_array/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | __kernel void foo () 5 | { 6 | 7 | __local int A[10]; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/OpenCL/pointertests/test_opencl_local_param/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | __kernel void foo (__global int* p, __local int* q) 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/OpenCL/pointertests/test_pass_value_from_array/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | void bar(float x) 6 | { 7 | 8 | } 9 | 10 | __kernel void foo(__global float* A) 11 | { 12 | bar(A[0]); 13 | } 14 | 15 | -------------------------------------------------------------------------------- /testsuite/OpenCL/pointertests/test_return_pointer/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=64 --no-inline 3 | 4 | 5 | 6 | __local int* bar(__local int* p) 7 | { 8 | return p; 9 | } 10 | 11 | __kernel void foo(__local int* A) 12 | { 13 | __local int* q; 14 | 15 | q = bar(A); 16 | 17 | q[get_local_id(0)] = get_local_id(0); 18 | 19 | } 20 | 21 | -------------------------------------------------------------------------------- /testsuite/OpenCL/pow2/64bit_loopcounter/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=32 --num_groups=2 3 | 4 | __kernel void foo(__global double *A, int n) 5 | { 6 | for(long i = n; i > 0; i >>= 1) { 7 | A[get_global_id(0)] = 0.0; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/OpenCL/pow2/64bit_relational/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=32 --num_groups=2 3 | 4 | __kernel void foo(__global double *A, int n) 5 | { 6 | long j = 1; 7 | for(long i = n; i > 0; i >>= 1) { 8 | A[get_global_id(0)] = 0.0; 9 | j *= 2; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/predicated_undef/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --clang-opt=-Wno-uninitialized --no-inline 3 | 4 | __kernel void k(__global int *input, __global int *output) { 5 | 6 | __local int sum[1024]; 7 | int temp; 8 | int offset = 1; 9 | 10 | if (get_local_id(0) >= offset) 11 | { 12 | // Purpose: to test uniformity analysis with undefined. 13 | sum[get_local_id(0)] = temp; 14 | } 15 | 16 | 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/OpenCL/privatememoryaccess/privatearraytest/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | __kernel void foo() { 5 | 6 | int x[10]; 7 | 8 | x[4] = 10; 9 | 10 | barrier(CLK_LOCAL_MEM_FENCE); 11 | 12 | int temp = x[4]; 13 | 14 | __assert(temp == 10); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/OpenCL/privatememoryaccess/privatevariabletest/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | void bar(int* p) { 5 | 6 | 7 | } 8 | 9 | 10 | __kernel void foo() { 11 | 12 | int x; 13 | 14 | x = 10; 15 | 16 | bar(&x); 17 | 18 | int temp = x; 19 | 20 | __assert(temp == 10); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /testsuite/OpenCL/privatememoryaccess/privatevariabletest2/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | __kernel void foo() { 5 | 6 | int x; 7 | 8 | x = 10; 9 | 10 | int* p; 11 | 12 | p = &x; 13 | 14 | *p = 20; 15 | 16 | __assert(x == 20); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/OpenCL/reducedstrength_generalised/kernel.cl: -------------------------------------------------------------------------------- 1 | //PASS 2 | //--local_size=1024 --num_groups=2 3 | 4 | __kernel void foo(__local int *data) 5 | { 6 | for (int i = 0; i < get_local_size(0) * 10; i += get_local_size(0)) { 7 | for (int j = i; j < get_local_size(0) * 10; j += get_local_size(0)) { 8 | data[j + get_local_id(0)] = get_local_id(0); 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/reducedstrengthnonloopbug/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=64 --num_groups=32 --no-inline 3 | 4 | #define MAX 1024 5 | 6 | void notInvoked(__local float* dst) { 7 | int i = get_local_id(0); 8 | while(i < MAX) { 9 | dst[i] = 0; 10 | i += get_local_size(0); 11 | } 12 | } 13 | 14 | __kernel void foo() { 15 | // deliberately does not invoke anything 16 | } 17 | 18 | -------------------------------------------------------------------------------- /testsuite/OpenCL/report_global_id/test2/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=2 --num_groups=5 3 | //Write by work item 0 with local id 0 in work group 0 4 | //Write by work item 7 with local id 1 in work group 3 5 | 6 | __kernel void foo(global int *p, int x) { 7 | if(get_global_id(0) == 0) { 8 | p[get_global_id(0)] = get_global_id(1); 9 | } 10 | if(get_global_id(0) == 7) { 11 | p[x] = 45; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/OpenCL/return_tests/id_dependent_return/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo(int x) 6 | { 7 | if (get_local_id(0) < 25) { 8 | return; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/return_tests/multiloop_return_simplified/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void bar(int y) { 6 | 7 | int result = 0; 8 | 9 | for(int j = 0; j < 100; j++) 10 | { 11 | if(result > 1000) { 12 | return; 13 | } 14 | result += j; 15 | } 16 | 17 | for(int j = 0; j < 100; j++) 18 | { 19 | result += j; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /testsuite/OpenCL/return_tests/simple_return/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo(int x) 6 | { 7 | if (get_local_id(0) < 25) { 8 | while (x + 100 < 102) { 9 | return; 10 | } 11 | } 12 | return; 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/OpenCL/rightshiftequals/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo() { 6 | unsigned int x = 1; 7 | signed int y = 2; 8 | 9 | x >>= x; 10 | y >>= x; 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/saturate/sadd/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1 3 | 4 | __kernel void test(__global int *A, __global int *B) { 5 | A[get_global_id(0)] = add_sat(A[get_global_id(0)], B[get_global_id(0)]); 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/OpenCL/saturate/ssub/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1 3 | 4 | __kernel void test(__global int *A, __global int *B) { 5 | A[get_global_id(0)] = sub_sat(A[get_global_id(0)], B[get_global_id(0)]); 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/OpenCL/saturate/uadd/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1 3 | 4 | __kernel void test(__global uint *A, __global uint *B) { 5 | A[get_global_id(0)] = add_sat(A[get_global_id(0)], B[get_global_id(0)]); 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/OpenCL/saturate/usub/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1 3 | 4 | __kernel void test(__global uint *A, __global uint *B) { 5 | A[get_global_id(0)] = sub_sat(A[get_global_id(0)], B[get_global_id(0)]); 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/OpenCL/shared_int/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=64 --num_groups=64 --no-inline 3 | //Write by work item[\s]+[\d]+[\s]+with local id[\s]+[\d]+[\s]+in work group[\s]+[\d]+.+kernel.cl:9:[\d]+:[\s]+a = get_local_id\(0\); 4 | 5 | 6 | __kernel void foo() { 7 | __local int a; 8 | 9 | a = get_local_id(0); 10 | 11 | } 12 | 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/shuffle/shuffle/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1 3 | 4 | __kernel void test(__global int4 *A, uint4 mask) { 5 | A[get_global_id(0)] = shuffle(A[get_global_id(0)], mask); 6 | } 7 | -------------------------------------------------------------------------------- /testsuite/OpenCL/shuffle/shuffle2/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1 3 | 4 | __kernel void test(__global int4 *A, __global int4 *B, 5 | __global int8 *C, uint8 mask) { 6 | C[get_global_id(0)] 7 | = shuffle2(A[get_global_id(0)], B[get_global_id(0)], mask); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/simpleparampassing/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | void f(int x) { 6 | 7 | } 8 | 9 | __kernel void foo() { 10 | 11 | f(2); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/OpenCL/simpleprocedurecall/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | void bar() { 4 | 5 | } 6 | 7 | __kernel void foo() { 8 | bar(); 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/OpenCL/simplereturn/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | int f(int x) { 6 | return x + 1; 7 | } 8 | 9 | __kernel void foo() { 10 | 11 | int y = f(2); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/OpenCL/sourcelocation_tests/barrier_divergence/pass/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1024 --no-inline 3 | 4 | 5 | 6 | __kernel void foo(__local int* a, __local int* b) { 7 | 8 | a[get_local_id(0)] = get_local_id(0); 9 | 10 | barrier(CLK_GLOBAL_MEM_FENCE); 11 | 12 | b[get_local_id(0)] = get_local_id(0); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/OpenCL/sourcelocation_tests/ensures/pass/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | 6 | int bar(int a) { 7 | __requires(a > 0); 8 | __ensures(__return_val_int() >= 0); 9 | return a/2; 10 | } 11 | 12 | __kernel void foo() { 13 | 14 | int x; 15 | x = bar(5); 16 | __assert(x >= 0); 17 | 18 | } 19 | 20 | 21 | -------------------------------------------------------------------------------- /testsuite/OpenCL/sourcelocation_tests/loop_invariant/pass/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo() { 6 | 7 | int x = 0; 8 | 9 | while(__invariant(x <= 100), x < 100) 10 | { 11 | x = x + 1; 12 | } 13 | 14 | } 15 | 16 | 17 | -------------------------------------------------------------------------------- /testsuite/OpenCL/sourcelocation_tests/needs_source_location_ensures/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1024 --no-inline 3 | 4 | 5 | 6 | void bar(__global int * p) { 7 | if(get_global_id(0) == 24) { 8 | p[0] = get_global_id(0); 9 | } 10 | } 11 | 12 | __kernel void foo(__global int * p) { 13 | 14 | bar(p); 15 | 16 | for(int i = 0; i < get_global_id(0); i++) { 17 | } 18 | 19 | } 20 | 21 | 22 | -------------------------------------------------------------------------------- /testsuite/OpenCL/sourcelocation_tests/needs_source_location_requires/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1024 --no-inline 3 | 4 | 5 | 6 | void bar(__global int * p) { 7 | int i; 8 | for(i = 0; i < get_global_id(0); i++) { 9 | } 10 | 11 | if(get_global_id(0) == 24) { 12 | p[i] = get_global_id(0); 13 | } 14 | 15 | 16 | } 17 | 18 | __kernel void foo(__global int * p) { 19 | 20 | bar(p); 21 | } 22 | 23 | 24 | -------------------------------------------------------------------------------- /testsuite/OpenCL/sourcelocation_tests/races/pass/no_race/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1024 --no-inline 3 | 4 | 5 | 6 | __kernel void foo(__local int * p, __local int * q, __local int * r) { 7 | 8 | if (get_local_id(0) > 10) { 9 | p[get_local_id(0)] = q[get_local_id(0)]; 10 | } 11 | 12 | if (get_local_id(0) <= 10) { 13 | r[get_local_id(0)] = p[get_local_id(0)]; 14 | } 15 | 16 | } 17 | 18 | 19 | -------------------------------------------------------------------------------- /testsuite/OpenCL/sourcelocation_tests/races/pass/read_read/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1024 --no-inline 3 | 4 | 5 | 6 | __kernel void foo(__local int * p, __local int * q, __local int * r) { 7 | 8 | p[get_local_id(0)] = q[get_local_id(0)]; 9 | r[get_local_id(0)] = q[get_local_id(0)]; 10 | 11 | } 12 | 13 | 14 | -------------------------------------------------------------------------------- /testsuite/OpenCL/ternarytest/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo(__local float* A) { 6 | 7 | A[get_local_id(0) == 0 ? 1 : 2*get_local_id(0)] = 2.4f; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/OpenCL/ternarytest2/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo(__local float* A) { 6 | 7 | A[get_local_id(0) ? 2*get_local_id(0) : 1] = 2.4f; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_address_of_bug/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo() { 6 | 7 | int*p; 8 | int a; 9 | 10 | p = &a; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_binary_stmt/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | __kernel void foo() 5 | { 6 | int x, y; 7 | 8 | x = 5, y = 4; 9 | 10 | __assert(x == 5); 11 | __assert(y == 4); 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_float_neq/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo(float a, float b) { 6 | 7 | int x; 8 | 9 | if (a != b) { 10 | x = 2; 11 | } 12 | 13 | } 14 | 15 | 16 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_for_benign_read_write_bug/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=64 --num_groups=64 --equality-abstraction --no-inline 3 | // 4 | 5 | //xfail 6 | //--local_size=1024 --num_groups=1024 --equality-abstraction 7 | // 8 | 9 | __kernel void foo(__local short* p) { 10 | 11 | p[0]++; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_for_get_group_id/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo(__global float* A) { 6 | 7 | if(get_group_id(0) == 0) { 8 | A[get_local_id(0)] = 42.f; 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_for_ssa_bug/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=2 --num_groups=1 --no-inline 3 | 4 | 5 | 6 | 7 | __kernel void foo(__local unsigned int* A) 8 | { 9 | for (unsigned int k = 0; k < 8; ++k) 10 | { 11 | if (get_local_id(0) == 0) 12 | { 13 | A[get_local_id(0)] = 0 + k; 14 | } 15 | 16 | barrier(CLK_LOCAL_MEM_FENCE); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_for_uniformity_bug/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=4 --num_groups=1 --no-inline 3 | 4 | #define N 4 5 | 6 | __kernel void k() { 7 | for (int i=0; 8 | __invariant(__uniform_int(i)), 9 | i= x && z >= y); 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_nooverflowing_add_predicate/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo(unsigned x, unsigned y, unsigned z) { 6 | __requires(__add_noovfl(x,y,z)); 7 | unsigned w; 8 | w = x + y + z; 9 | __assert(w >= x && w >= y && w >= z); 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_nooverflowing_add_signed/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void foo(int x, int y) { 6 | int z; 7 | z = __add_noovfl_int(x, y); 8 | __assert(x > 0 ? z > y : 1); 9 | } 10 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_part_load_store/load_ptr_and_int/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=2 3 | 4 | struct a { 5 | __global int *p; 6 | int i; 7 | }; 8 | 9 | __kernel void foo(__global struct a *q1, 10 | __global struct a *q2) { 11 | q2[get_global_id(0)].i = q1[get_global_id(0)].i; 12 | q2[get_global_id(0)].p = q1[get_global_id(0)].p; 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_part_load_store/load_ptr_and_short2/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=2 3 | 4 | struct a { 5 | __global int *p; 6 | short2 i; 7 | }; 8 | 9 | __kernel void foo(__global struct a *q1, 10 | __global struct a *q2) { 11 | q2[get_global_id(0)].i = q1[get_global_id(0)].i; 12 | q2[get_global_id(0)].p = q1[get_global_id(0)].p; 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_part_load_store/load_ptr_array_and_int/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=2 3 | 4 | struct a { 5 | __global int *p[5]; 6 | int i; 7 | }; 8 | 9 | __kernel void foo(__global struct a *q1, 10 | __global struct a *q2) { 11 | q2[get_global_id(0)].i = q1[get_global_id(0)].i; 12 | q2[get_global_id(0)].p[3] = q1[get_global_id(0)].p[3]; 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_part_load_store/store_int_and_short/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=2 3 | 4 | struct a { 5 | int i; 6 | short s; 7 | }; 8 | 9 | __kernel void foo(__global struct a *q) { 10 | q[get_global_id(0)].i = 42; 11 | q[get_global_id(0)].s = 43; 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_part_load_store/store_ptr_and_int/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=2 3 | 4 | struct a { 5 | __global int *p; 6 | int i; 7 | }; 8 | 9 | __kernel void foo(__global int *p, __global struct a *q) { 10 | q[get_global_id(0)].i = 42; 11 | q[get_global_id(0)].p = p; 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_part_load_store/store_ptr_and_short/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=2 3 | 4 | struct a { 5 | __global int *p; 6 | short i; 7 | }; 8 | 9 | __kernel void foo(__global int *p, __global struct a *q) { 10 | q[get_global_id(0)].i = 42; 11 | q[get_global_id(0)].p = p; 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_part_load_store/store_ptr_and_short2/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=2 3 | 4 | struct a { 5 | __global int *p; 6 | short2 i; 7 | }; 8 | 9 | __kernel void foo(__global int *p, __global struct a *q) { 10 | q[get_global_id(0)].i = (short2){42, 43}; 11 | q[get_global_id(0)].p = p; 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_part_load_store/store_ptr_array_and_int/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=2 3 | 4 | struct a { 5 | __global int *p[5]; 6 | int i; 7 | }; 8 | 9 | __kernel void foo(__global int *p, __global struct a *q) { 10 | q[get_global_id(0)].i = 42; 11 | q[get_global_id(0)].p[3] = p; 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_structs/requires/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=2048 --num_groups=64 3 | 4 | struct s { 5 | int a; 6 | }; 7 | 8 | __kernel void foo(struct s q) { 9 | __requires(q.a == 5); 10 | __assert(q.a == 5); 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_structs/requires_with_store/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=2048 --num_groups=64 3 | 4 | struct s { 5 | int a; 6 | int b; 7 | }; 8 | 9 | __kernel void foo(__global int *p, struct s q) { 10 | __requires(q.a == 5); 11 | q.b = p[get_global_id(0)]; 12 | __assert(q.a == 5); 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_structs/store_array_element/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=2048 --num_groups=64 3 | 4 | struct s { 5 | int a[5]; 6 | }; 7 | 8 | __kernel void foo(__global int *p, struct s q) { 9 | q.a[3] = p[get_global_id(0)]; 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_structs/store_element/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=2048 --num_groups=64 3 | 4 | struct s { 5 | int a; 6 | int b; 7 | }; 8 | 9 | __kernel void foo(__global int *p, struct s q) { 10 | q.b = p[get_global_id(0)]; 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_structs/store_ptr_array_element/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=2048 --num_groups=64 3 | 4 | struct s { 5 | __global int *p[5]; 6 | }; 7 | 8 | __kernel void foo(__global int *p, struct s q) { 9 | q.p[3] = p; 10 | q.p[3][get_global_id(0)] = 5; 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_structs/store_ptr_element/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=2048 --num_groups=64 3 | 4 | struct s { 5 | __global int *p; 6 | }; 7 | 8 | __kernel void foo(__global int *p, struct s q) { 9 | q.p = p; 10 | q.p[get_global_id(0)] = 5; 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_structs/store_struct_element/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=2048 --num_groups=64 3 | 4 | struct s { 5 | struct t { 6 | int a; 7 | } a; 8 | }; 9 | 10 | __kernel void foo(__global int *p, struct s q) { 11 | q.a.a = p[get_global_id(0)]; 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_structs/use_array_element/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=2048 --num_groups=64 3 | 4 | struct s { 5 | int a[6]; 6 | }; 7 | 8 | __kernel void foo(__global int *p, struct s q) { 9 | p[get_global_id(0)] = q.a[3]; 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_structs/use_element/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=2048 --num_groups=64 3 | 4 | struct s { 5 | int a; 6 | int b; 7 | }; 8 | 9 | __kernel void foo(__global int *p, struct s q) { 10 | p[get_global_id(0)] = q.b; 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_structs/use_ptr_array_element/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=2048 --num_groups=64 3 | 4 | struct s { 5 | __global int *p[5]; 6 | }; 7 | 8 | __kernel void foo(__global int *p, struct s q) { 9 | __requires(q.p[3] == p); 10 | p[get_global_id(0)] = q.p[3][get_global_id(0)]; 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_structs/use_ptr_element/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=2048 --num_groups=64 3 | 4 | struct s { 5 | __global int *p; 6 | }; 7 | 8 | __kernel void foo(__global int *p, struct s q) { 9 | __requires(q.p == p); 10 | p[get_global_id(0)] = q.p[get_global_id(0)]; 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/test_structs/use_struct_element/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=2048 --num_groups=64 3 | 4 | struct s { 5 | int _; 6 | struct t { 7 | int a; 8 | } a; 9 | }; 10 | 11 | __kernel void foo(__global int *p, struct s q) { 12 | p[get_global_id(0)] = q.a.a; 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/OpenCL/typestest/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | char bar(void); 5 | 6 | __kernel void foo() 7 | { 8 | char x = bar(); 9 | 10 | x = x + x; 11 | x++; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/OpenCL/unconstrained_sizes/global_size/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --global_size=* 3 | 4 | kernel void foo (local int* A) { 5 | __assert(get_global_size(0) % 1024 == 0); 6 | __assert(get_num_groups(0) * 1024 == get_global_size(0)); 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/OpenCL/unconstrained_sizes/local_size/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=* --global_size=1024 3 | 4 | kernel void foo (local int* A) { 5 | __assert(get_local_size(0) > 0); 6 | __assert(get_local_size(0) <= 1024); 7 | __assert(get_global_size(0) % get_local_size(0) == 0); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/unconstrained_sizes/num_groups/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=* 3 | 4 | kernel void foo (local int* A) { 5 | __assert(get_global_size(0) % 1024 == 0); 6 | __assert(get_num_groups(0) * 1024 == get_global_size(0)); 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/OpenCL/undef_tests/uninitialised_local_int/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=64 --num_groups=64 --clang-opt=-Wno-uninitialized --no-inline 3 | //kernel.cl:9:3:[\s]+error:[\s]+this assertion might not hold for work item [\d]+ with local id [\d]+ in work group [\d]+[\s]+__assert\(x == 0\); 4 | 5 | 6 | 7 | __kernel void foo() { 8 | int x; 9 | __assert(x == 0); 10 | } 11 | 12 | 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/undef_tests/uninitialised_local_ptr/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=64 --num_groups=64 --clang-opt=-Wno-uninitialized --no-inline 3 | //kernel.cl:9:3:[\s]+error:[\s]+this assertion might not hold for work item [\d]+ with local id [\d]+ in work group [\d]+[\s]+__assert\(x == 0\); 4 | 5 | 6 | 7 | __kernel void foo() { 8 | int* x; 9 | __assert(x == 0); 10 | } 11 | 12 | 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/unreachable/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=1024 --num_groups=1 --no-inline 3 | //this assertion might not hold for work item 4 | 5 | void f(__global int *a) __attribute__ ((noreturn)); 6 | 7 | __kernel 8 | void k(__global int *a) 9 | { 10 | f(a); 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/unusedreturn/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | int bar() { 4 | 5 | return 0; 6 | 7 | } 8 | 9 | __kernel void foo() { 10 | 11 | bar(); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/OpenCL/vectortests/addressofvector/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | void bar(int4 * p) 6 | { 7 | } 8 | 9 | __kernel void foo() { 10 | 11 | int4 v; 12 | bar(&v); 13 | 14 | } 15 | 16 | 17 | -------------------------------------------------------------------------------- /testsuite/OpenCL/vectortests/double2simpleaccess/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | #pragma OPENCL EXTENSION cl_khr_fp64: enable 4 | 5 | 6 | __kernel void k() { 7 | double2 v; 8 | double s; 9 | v.x = 42.0f; 10 | v.y = 42.0f; 11 | s = v.x; 12 | s = v.y; 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/OpenCL/vectortests/double4simpleaccess/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | #pragma OPENCL EXTENSION cl_khr_fp64: enable 4 | 5 | 6 | __kernel void k() { 7 | double4 v; 8 | double s; 9 | v.x = 42.0f; 10 | v.y = 42.0f; 11 | v.z = 42.0f; 12 | v.w = 42.0f; 13 | s = v.x; 14 | s = v.y; 15 | s = v.z; 16 | s = v.w; 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/OpenCL/vectortests/float2simpleaccess/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | __kernel void k() { 6 | float2 v; 7 | float s; 8 | v.x = 42.0f; 9 | v.y = 42.0f; 10 | s = v.x; 11 | s = v.y; 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/vectortests/float4arrayaccess/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=2048 --num_groups=64 --no-inline 3 | 4 | 5 | 6 | __kernel void foo(__global float* p) { 7 | 8 | __local float4 vs[2048]; 9 | 10 | vs[get_local_id(0)].x = p[get_global_id(0)]; 11 | 12 | volatile float f; 13 | 14 | f = vs[get_local_id(0)].x; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/OpenCL/vectortests/float4simpleaccess/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | 6 | __kernel void foo() { 7 | 8 | float4 v; 9 | 10 | v.x = 4.0f; 11 | 12 | float f; 13 | 14 | f = v.x; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/OpenCL/vectortests/int2simpleaccess/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | 6 | __kernel void foo() { 7 | 8 | int2 v; 9 | 10 | v.y = 1; 11 | 12 | int i; 13 | 14 | i = v.y; 15 | 16 | __assert(i == 1); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/OpenCL/vectortests/int3arrayaccess/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=2048 --num_groups=64 --no-inline 3 | 4 | 5 | 6 | __kernel void foo(__global int* p) { 7 | 8 | __local int3 vs[2048]; 9 | 10 | vs[get_local_id(0)].x = p[get_global_id(0)]; 11 | 12 | volatile int i; 13 | 14 | i = vs[get_local_id(0)].x; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/OpenCL/vectortests/int3load/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=2048 --num_groups=64 3 | 4 | int3 bar(void); 5 | 6 | __kernel void foo() { 7 | int3 x = bar(); 8 | int3 y = (int3)(0, 0, 0); 9 | y += x; 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/vectortests/int3store/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=2048 --num_groups=64 3 | 4 | int3 bar(void); 5 | 6 | __kernel void foo() { 7 | int3 x = bar(); 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/OpenCL/vectortests/select/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | float4 bar(void); 5 | 6 | __kernel void foo() { 7 | float4 a = bar(); 8 | float4 b = bar(); 9 | float4 c = bar(); 10 | float4 r = select(a, b, c <= 0.1f); 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/OpenCL/vectortests/test_paren/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --equality-abstraction --no-inline 3 | 4 | 5 | 6 | __kernel void foo(__global float4* acc) { 7 | 8 | float4 r; 9 | 10 | r = (float4)(1, 2, 3, 4); 11 | 12 | acc[get_local_id(0)] = r; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/OpenCL/vectortests/vectorops2/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | char bar(void); 5 | 6 | uchar3 baz(void); 7 | 8 | __kernel void foo() { 9 | 10 | char h = bar(); 11 | h <<= 1; 12 | 13 | h <<= h; 14 | 15 | uchar3 v = baz(); 16 | 17 | v <<= v; 18 | 19 | v = v ^ v; 20 | 21 | } 22 | 23 | 24 | -------------------------------------------------------------------------------- /testsuite/OpenCL/vectortests/vectorsplat/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | 6 | __kernel void foo() { 7 | float4 inRand = 1.0f; 8 | char3 a = 15; 9 | uchar4 v = (uchar4)(0); 10 | } 11 | 12 | 13 | -------------------------------------------------------------------------------- /testsuite/OpenCL/vectortests/vectorswizzle/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=64 --num_groups=64 --no-inline 3 | 4 | 5 | 6 | __kernel 7 | void foo() 8 | { 9 | uchar4 start = (uchar4)(1,2,3,4); 10 | uchar4 temp4; 11 | uchar3 temp3; 12 | uchar2 temp2; 13 | 14 | temp4 = start.yyxx; 15 | temp3 = start.zyx; 16 | temp2 = temp3.zx; 17 | 18 | 19 | } 20 | 21 | -------------------------------------------------------------------------------- /testsuite/OpenCL/warpsync/broken_shuffle/kernel.cl: -------------------------------------------------------------------------------- 1 | //xfail:NOT_ALL_VERIFIED 2 | //--local_size=1024 --num_groups=1 --warp-sync=16 --no-inline 3 | 4 | __kernel void shuffle (__local int* A) 5 | { 6 | int tid = get_local_id(0); 7 | int warp = tid / 32; 8 | __local int* B = A + (warp*32); 9 | A[tid] = B[(tid + 1)%32]; 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/OpenCL/warpsync/shuffle/kernel.cl: -------------------------------------------------------------------------------- 1 | //pass 2 | //--local_size=1024 --num_groups=1 --warp-sync=32 --no-inline 3 | 4 | __kernel void shuffle (__local int* A) 5 | { 6 | int tid = get_local_id(0); 7 | int warp = tid / 32; 8 | __local int* B = A + (warp*32); 9 | A[tid] = B[(tid + 1)%32]; 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/baseline.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mc-imperial/gpuverify/49219770aad01231edd0d8e0fa3ed036006cf32a/testsuite/baseline.pickle -------------------------------------------------------------------------------- /testsuite/misc/local_revision/local_revision.misc: -------------------------------------------------------------------------------- 1 | //pass 2 | //--version 3 | //^local-revision\s+:\s+\d+ 4 | 5 | /* 6 | * This tests that --version shows 7 | * the Mercurial local revision number. 8 | * 9 | * GPUVerifyRise4Fun depends on this functionality. 10 | * Do not change it unless you know what you're doing! 11 | */ 12 | -------------------------------------------------------------------------------- /testsuite/misc/version_info/version_info.misc: -------------------------------------------------------------------------------- 1 | //pass 2 | //--version 3 | //^llvm\s+:\s+.* 4 | //^bugle\s+:\s+[0-9a-z]{40} 5 | //^libclc\s+:\s+.* 6 | //^vcgen\s+:\s+[0-9a-z]{40} 7 | //^z3\s+:\s+.* 8 | //^cvc4\s+:\s+.* 9 | 10 | /* 11 | * This test checks that GPUVerify's 12 | * --version output is sane and is 13 | * not missing anything. 14 | * 15 | */ 16 | -------------------------------------------------------------------------------- /utils/GPUVerifyRise4Fun/cuda/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mc-imperial/gpuverify/49219770aad01231edd0d8e0fa3ed036006cf32a/utils/GPUVerifyRise4Fun/cuda/__init__.py -------------------------------------------------------------------------------- /utils/GPUVerifyRise4Fun/cuda/samples/add_neighbour_bug.cu: -------------------------------------------------------------------------------- 1 | //--blockDim=1024 --gridDim=1 2 | 3 | /* 4 | * The intention of this kernel is to increment each 5 | * element of 'A' with its neighbouring element, 6 | * 'offset' places away. 7 | * 8 | * Can you spot the deliberate data race bug? 9 | */ 10 | 11 | __global__ void add_neighbour(int *A, int offset) { 12 | int tid = threadIdx.x; 13 | A[tid] += A[tid + offset]; 14 | } 15 | -------------------------------------------------------------------------------- /utils/GPUVerifyRise4Fun/cuda/syntax.py: -------------------------------------------------------------------------------- 1 | """ vim: set sw=2 ts=2 softtabstop=2 expandtab: 2 | 3 | This file provides the CUDA C syntax definition for Rise4Fun web service 4 | 5 | """ 6 | 7 | #TODO 8 | syntax = None 9 | -------------------------------------------------------------------------------- /utils/GPUVerifyRise4Fun/observers/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mc-imperial/gpuverify/49219770aad01231edd0d8e0fa3ed036006cf32a/utils/GPUVerifyRise4Fun/observers/__init__.py -------------------------------------------------------------------------------- /utils/GPUVerifyRise4Fun/opencl/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mc-imperial/gpuverify/49219770aad01231edd0d8e0fa3ed036006cf32a/utils/GPUVerifyRise4Fun/opencl/__init__.py -------------------------------------------------------------------------------- /utils/GPUVerifyRise4Fun/opencl/samples/add_neighbour_bug.cl: -------------------------------------------------------------------------------- 1 | //--local_size=1024 --global_size=1024 2 | 3 | /* 4 | * The intention of this kernel is to increment each 5 | * element of 'A' with its neighbouring element, 6 | * 'offset' places away. 7 | * 8 | * Can you spot the deliberate data race bug? 9 | */ 10 | 11 | __kernel void add_neighbour(__local int *A, int offset) { 12 | int tid = get_local_id(0); 13 | A[tid] += A[tid + offset]; 14 | } 15 | -------------------------------------------------------------------------------- /utils/GPUVerifyRise4Fun/opencl/syntax.py: -------------------------------------------------------------------------------- 1 | """ vim: set sw=2 ts=2 softtabstop=2 expandtab: 2 | 3 | This file provides the OpenCL C syntax definition for Rise4Fun web service 4 | 5 | """ 6 | 7 | #TODO 8 | syntax = None 9 | -------------------------------------------------------------------------------- /utils/GPUVerifyRise4Fun/opencl/tutorials/tutorial_1/kernel1.cl: -------------------------------------------------------------------------------- 1 | // --local_size=64 --num_groups=64 2 | __kernel void foo(__local int* A, __local int* B, int i, int j) { 3 | A[i] = i; 4 | B[j] = A[j]; 5 | } 6 | -------------------------------------------------------------------------------- /utils/GPUVerifyRise4Fun/opencl/tutorials/tutorial_1/test.md: -------------------------------------------------------------------------------- 1 | #This is a test 2 | 3 | Here is some code 4 | kernel1.cl 5 | -------------------------------------------------------------------------------- /utils/GPUVerifyRise4Fun/static/imperial-college-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mc-imperial/gpuverify/49219770aad01231edd0d8e0fa3ed036006cf32a/utils/GPUVerifyRise4Fun/static/imperial-college-logo.png -------------------------------------------------------------------------------- /utils/GPUVerifyRise4Fun/static/privacy-policy.html: -------------------------------------------------------------------------------- 1 | Privacy Policy 2 | FIXME 3 | -------------------------------------------------------------------------------- /utils/GPUVerifyRise4Fun/static/terms-of-use.html: -------------------------------------------------------------------------------- 1 | Terms of Use 2 | FIX ME 3 | --------------------------------------------------------------------------------