├── .gitmodules ├── CMakeLists.txt ├── Jenkinsfile ├── LICENSE.TXT ├── README.md ├── SYNC_UPSTREAM.md ├── benchmarks ├── AcceleratorViewCopy │ ├── avstress_0x18.cpp │ └── avstress_0xFF.cpp ├── RuntimeOverheads │ ├── kernel_dispatch_latency.cpp │ └── kernel_enqueue_overhead.cpp └── benchEmptyKernel │ ├── Makefile │ ├── README │ ├── bench.cpp │ ├── hsacodelib.CPP │ ├── hsacodelib.h │ ├── nullkernel.cpp │ ├── plot.plt │ ├── runbench.sh │ ├── statutils.CPP │ └── statutils.h ├── cmake-tests ├── CMakeLists.txt └── cmake-test.cpp ├── doc ├── CMakeLists.txt ├── CppAMPOpenSpecificationV12.pdf └── markdown │ ├── Home.md │ └── hcc_profile.md ├── docker-compose.yml ├── docker ├── dockerfile-auto-upstream-merge-ubuntu-16.04 ├── dockerfile-build-centos-7 ├── dockerfile-build-ubuntu-14.04 ├── dockerfile-build-ubuntu-16.04 └── dockerfile-hcc-lc-ubuntu-16.04 ├── hc2 ├── external │ └── elfio │ │ ├── elf_types.hpp │ │ ├── elfio.hpp │ │ ├── elfio_amdgpu.hpp │ │ ├── elfio_dump.hpp │ │ ├── elfio_dynamic.hpp │ │ ├── elfio_header.hpp │ │ ├── elfio_note.hpp │ │ ├── elfio_relocation.hpp │ │ ├── elfio_section.hpp │ │ ├── elfio_segment.hpp │ │ ├── elfio_strings.hpp │ │ ├── elfio_symbols.hpp │ │ └── elfio_utils.hpp └── headers │ ├── functions │ ├── hsa_interfaces.hpp │ └── integer_computational_basis.hpp │ └── types │ ├── code_object_bundle.hpp │ ├── program_state.hpp │ ├── raii_handle.hpp │ └── type_support.hpp ├── hcc_config ├── CMakeLists.txt ├── hcc_config.cpp └── hcc_config.hxx.in ├── include ├── CMakeLists.txt ├── array_view ├── coordinate ├── experimental │ ├── CMakeLists.txt │ ├── algorithm │ ├── exception_list │ ├── execution_policy │ ├── impl │ │ ├── algorithm_impl.inl │ │ ├── algorithm_impl_seq.inl │ │ ├── exclusive_scan.inl │ │ ├── inclusive_scan.inl │ │ ├── kernel_launch.inl │ │ ├── numeric_impl_seq.inl │ │ ├── reduce.inl │ │ ├── scan.inl │ │ ├── sort.inl │ │ ├── stablesort.inl │ │ ├── transform.inl │ │ ├── transform_exclusive_scan.inl │ │ ├── transform_inclusive_scan.inl │ │ ├── transform_reduce.inl │ │ ├── transform_scan.inl │ │ └── type_utils.inl │ └── numeric ├── grid_launch.h ├── grid_launch.hpp ├── hc.hpp ├── hc_am.hpp ├── hc_am_internal.hpp ├── hc_defines.h ├── hc_math.hpp ├── hc_norm_unorm.inl ├── hc_printf.hpp ├── hc_prof_runtime.h ├── hc_rt_debug.h ├── hc_short_vector.hpp ├── hc_short_vector.inl ├── hcc_features.hpp ├── hsa_atomic.h ├── kalmar_aligned_alloc.h ├── kalmar_buffer.h ├── kalmar_cpu_launch.h ├── kalmar_exception.h ├── kalmar_index.h ├── kalmar_launch.h ├── kalmar_math.h ├── kalmar_runtime.h ├── kalmar_serialize.h ├── kalmar_short_vectors.inl └── pinned_vector.hpp ├── lib ├── CMakeLists.txt ├── clamp-assemble.in ├── clamp-device.in ├── clamp-embed.in ├── clamp-link.in ├── doxygen_config.in ├── error-check.in ├── extractkernel.in ├── hc-host-assemble.in ├── hc-kernel-assemble.in ├── hcc-config.cmake.in ├── hsa │ ├── CMakeLists.txt │ ├── activity_prof.h │ ├── hc_am.cpp │ ├── mcwamp_hsa.cpp │ ├── unpinned_copy_engine.cpp │ └── unpinned_copy_engine.h ├── mcwamp.cpp ├── mcwamp_impl.hpp └── rpt ├── packaging └── debian │ ├── postinst.in │ ├── preinst_rpm.in │ ├── prerm.in │ └── process_packaging_script.bsh ├── scripts └── cmake │ ├── GenerateVersionFromGit.cmake │ ├── ImportedTargets.cmake │ └── MCWAMP.cmake ├── stl-test ├── CMakeLists.txt ├── Tests │ ├── array_view │ │ ├── array_view │ │ │ ├── Negative │ │ │ │ ├── test1.cpp │ │ │ │ ├── test10.cpp │ │ │ │ ├── test11.cpp │ │ │ │ ├── test12.cpp │ │ │ │ ├── test13.cpp │ │ │ │ ├── test14.cpp │ │ │ │ ├── test15.cpp │ │ │ │ ├── test16.cpp │ │ │ │ ├── test17.cpp │ │ │ │ ├── test2.cpp │ │ │ │ ├── test3.cpp │ │ │ │ ├── test4.cpp │ │ │ │ ├── test5.cpp │ │ │ │ ├── test6.cpp │ │ │ │ ├── test7.cpp │ │ │ │ ├── test8.cpp │ │ │ │ └── test9.cpp │ │ │ └── array_view.cpp │ │ └── stride_array_view │ │ │ ├── Negative │ │ │ ├── test1.cpp │ │ │ ├── test2.cpp │ │ │ ├── test3.cpp │ │ │ ├── test4.cpp │ │ │ ├── test5.cpp │ │ │ ├── test6.cpp │ │ │ └── test7.cpp │ │ │ └── stride_array_view.cpp │ └── coordinate │ │ ├── bounds │ │ ├── Negative │ │ │ ├── test1.cpp │ │ │ ├── test10.cpp │ │ │ ├── test11.cpp │ │ │ ├── test12.cpp │ │ │ ├── test13.cpp │ │ │ ├── test14.cpp │ │ │ ├── test15.cpp │ │ │ ├── test16.cpp │ │ │ ├── test17.cpp │ │ │ ├── test2.cpp │ │ │ ├── test3.cpp │ │ │ ├── test4.cpp │ │ │ ├── test5.cpp │ │ │ ├── test6.cpp │ │ │ ├── test7.cpp │ │ │ ├── test8.cpp │ │ │ └── test9.cpp │ │ ├── access.cpp │ │ ├── arithmetic.cpp │ │ ├── construction.cpp │ │ ├── equality.cpp │ │ ├── iterators.cpp │ │ └── observer.cpp │ │ ├── bounds_iterator │ │ ├── Negative │ │ │ └── test1.cpp │ │ └── test.cpp │ │ ├── helper.h │ │ └── index │ │ ├── Negative │ │ ├── test1.cpp │ │ ├── test2.cpp │ │ ├── test3.cpp │ │ ├── test4.cpp │ │ ├── test5.cpp │ │ ├── test6.cpp │ │ ├── test7.cpp │ │ └── test8.cpp │ │ ├── access.cpp │ │ ├── arithmetic.cpp │ │ ├── construction.cpp │ │ └── equality.cpp ├── run_tests.pl.in └── test_one.pl.in ├── tests ├── CMakeLists.txt ├── Conformance │ └── 2_Cxx_Lang_Exte │ │ ├── 2_1_Synt │ │ └── 2_1_1_Func_Decl_Synt │ │ │ └── Negative │ │ │ └── Test.04 │ │ │ └── test.cpp │ │ └── 2_3_Expr_Invo_Rest_Func │ │ └── 2_3_2_Func_Over │ │ └── 2_3_2_1_Over_Reso │ │ └── Overloading │ │ ├── Overloading.01 │ │ └── test.cpp │ │ ├── Overloading.04 │ │ └── test.cpp │ │ ├── Overloading.09 │ │ └── test.cpp │ │ ├── Overloading.12 │ │ └── test.cpp │ │ ├── Overloading.15 │ │ └── test.cpp │ │ ├── Overloading.66 │ │ └── test.cpp │ │ ├── Overloading.68 │ │ └── test.cpp │ │ ├── Overloading.69 │ │ └── test.cpp │ │ ├── Overloading.71 │ │ └── test.cpp │ │ ├── Overloading.72 │ │ └── test.cpp │ │ └── Overloading.73 │ │ └── test.cpp ├── Unit │ ├── AM │ │ ├── am_aligned_alloc.cpp │ │ ├── am_alloc.cpp │ │ └── am_memtracker.cpp │ ├── AMDGPU │ │ ├── __int128.cpp │ │ ├── activelanecount.cpp │ │ ├── activelaneid.cpp │ │ ├── activelanemask.cpp │ │ ├── ballot.cpp │ │ ├── bitextract.cpp │ │ ├── bitinsert.cpp │ │ ├── bitselect.cpp │ │ ├── clock.cpp │ │ ├── clock2.cpp.donotrun │ │ ├── firstbit.cpp │ │ ├── laneid.cpp │ │ ├── popcount.cpp │ │ ├── register-control.cpp │ │ ├── shfl.cpp │ │ ├── shfl_down.cpp │ │ ├── shfl_scan.cpp │ │ ├── shfl_up.cpp │ │ ├── shfl_xor.cpp │ │ ├── vote_any_all.cpp │ │ ├── vote_ballot.cpp │ │ └── wavesize.cpp │ ├── AcceleratorViewCopy │ │ ├── avcopy_classic.cpp │ │ ├── avcopy_with_offsets_host_locked.cpp │ │ ├── avcopy_with_offsets_host_unlocked.cpp │ │ ├── avfunc_l5_sync.cpp │ │ ├── common.h │ │ ├── common2.h │ │ ├── copy_coherency.cpp │ │ └── copy_coherency2.cpp │ ├── AmpMath │ │ ├── amp_math_acos.cpp │ │ ├── amp_math_acos_precise_math.cpp │ │ ├── amp_math_acosf.cpp │ │ ├── amp_math_acosh_precise_math.cpp │ │ ├── amp_math_asin.cpp │ │ ├── amp_math_asin_precise_math.cpp │ │ ├── amp_math_asinf.cpp │ │ ├── amp_math_asinh_precise_math.cpp │ │ ├── amp_math_atan.cpp │ │ ├── amp_math_atan2.cpp │ │ ├── amp_math_atan2_precise_math.cpp │ │ ├── amp_math_atan2f.cpp │ │ ├── amp_math_atan2f_precise_math.cpp │ │ ├── amp_math_atan_precise_math.cpp │ │ ├── amp_math_atanf.cpp │ │ ├── amp_math_atanh_precise_math.cpp │ │ ├── amp_math_cbrt_precise_math.cpp │ │ ├── amp_math_cbrtf_precise_math.cpp │ │ ├── amp_math_ceil.cpp │ │ ├── amp_math_ceil_precise_math.cpp │ │ ├── amp_math_ceilf.cpp │ │ ├── amp_math_copysign_precise_math.cpp │ │ ├── amp_math_copysignf_precise_math.cpp │ │ ├── amp_math_cos.cpp │ │ ├── amp_math_cos_precise_math.cpp │ │ ├── amp_math_cosf.cpp │ │ ├── amp_math_cosh.cpp │ │ ├── amp_math_cosh_precise_math.cpp │ │ ├── amp_math_coshf.cpp │ │ ├── amp_math_coshf_precise_math.cpp │ │ ├── amp_math_cospi_precise_math.cpp │ │ ├── amp_math_cospif_precise_math.cpp │ │ ├── amp_math_erf_precise_math.cpp │ │ ├── amp_math_erfc_precise_math.cpp │ │ ├── amp_math_erfcf_precise_math.cpp │ │ ├── amp_math_erff_precise_math.cpp │ │ ├── amp_math_exp.cpp │ │ ├── amp_math_exp10.cpp │ │ ├── amp_math_exp10_precise_math.cpp │ │ ├── amp_math_exp10f.cpp │ │ ├── amp_math_exp2.cpp │ │ ├── amp_math_exp2_precise_math.cpp │ │ ├── amp_math_exp2f.cpp │ │ ├── amp_math_exp_precise_math.cpp │ │ ├── amp_math_expf.cpp │ │ ├── amp_math_expf_precise_math.cpp.donotrun │ │ ├── amp_math_expm1.cpp │ │ ├── amp_math_expm1_precise_math.cpp │ │ ├── amp_math_expm1f.cpp │ │ ├── amp_math_fdim_precise_math.cpp │ │ ├── amp_math_floor.cpp │ │ ├── amp_math_floor_precise_math.cpp │ │ ├── amp_math_floorf.cpp │ │ ├── amp_math_fma_precise_math.cpp │ │ ├── amp_math_fmaf_precise_math.cpp │ │ ├── amp_math_fmax.cpp │ │ ├── amp_math_fmax_precise_math.cpp │ │ ├── amp_math_fmaxf.cpp │ │ ├── amp_math_fmin.cpp │ │ ├── amp_math_fmin_precise_math.cpp │ │ ├── amp_math_fminf.cpp │ │ ├── amp_math_fmod.cpp │ │ ├── amp_math_fmod_precise_math.cpp │ │ ├── amp_math_fmodf.cpp │ │ ├── amp_math_hypot_precise_math.cpp │ │ ├── amp_math_ilogb.cpp │ │ ├── amp_math_ilogb_precise_math.cpp │ │ ├── amp_math_ilogbf.cpp │ │ ├── amp_math_isfinite.cpp │ │ ├── amp_math_isfinite_precise_math.cpp │ │ ├── amp_math_isinf.cpp │ │ ├── amp_math_isinf_precise_math.cpp │ │ ├── amp_math_isnan.cpp │ │ ├── amp_math_isnan_precise_math.cpp │ │ ├── amp_math_isnormal.cpp │ │ ├── amp_math_isnormal_precise_math.cpp │ │ ├── amp_math_ldexp.cpp │ │ ├── amp_math_ldexp_precise_math.cpp │ │ ├── amp_math_ldexpf.cpp │ │ ├── amp_math_ldexpf_precise_math.cpp │ │ ├── amp_math_log.cpp │ │ ├── amp_math_log10.cpp │ │ ├── amp_math_log10_precise_math.cpp │ │ ├── amp_math_log10f.cpp │ │ ├── amp_math_log1p_precise_math.cpp │ │ ├── amp_math_log1pf_precise_math.cpp │ │ ├── amp_math_log2.cpp │ │ ├── amp_math_log2_precise_math.cpp │ │ ├── amp_math_log2f.cpp │ │ ├── amp_math_log_precise_math.cpp │ │ ├── amp_math_logb_precise_math.cpp │ │ ├── amp_math_logbf_precise_math.cpp │ │ ├── amp_math_max.cpp │ │ ├── amp_math_max_precise_math.cpp │ │ ├── amp_math_min.cpp │ │ ├── amp_math_min_precise_math.cpp │ │ ├── amp_math_nearbyint_precise_math.cpp │ │ ├── amp_math_nextafter_precise_math.cpp │ │ ├── amp_math_pow.cpp │ │ ├── amp_math_pow_precise_math.cpp │ │ ├── amp_math_powf.cpp │ │ ├── amp_math_rcbrt_precise_math.cpp │ │ ├── amp_math_rcbrtf_precise_math.cpp │ │ ├── amp_math_remainder_precise_math.cpp │ │ ├── amp_math_remainderf_precise_math.cpp │ │ ├── amp_math_round.cpp │ │ ├── amp_math_round_precise_math.cpp │ │ ├── amp_math_roundf.cpp │ │ ├── amp_math_rsqrt.cpp │ │ ├── amp_math_rsqrt_precise_math.cpp │ │ ├── amp_math_rsqrtf.cpp │ │ ├── amp_math_scalb_precise_math.cpp │ │ ├── amp_math_scalbn_precise_math.cpp │ │ ├── amp_math_scalbnf_precise_math.cpp │ │ ├── amp_math_signbit.cpp │ │ ├── amp_math_signbit_precise_math.cpp │ │ ├── amp_math_signbitf.cpp │ │ ├── amp_math_sin.cpp │ │ ├── amp_math_sin_precise_math.cpp │ │ ├── amp_math_sinf.cpp │ │ ├── amp_math_sinh.cpp │ │ ├── amp_math_sinh_precise_math.cpp │ │ ├── amp_math_sinpi_precise_math.cpp │ │ ├── amp_math_sinpif_precise_math.cpp │ │ ├── amp_math_sqrt.cpp │ │ ├── amp_math_sqrt_precise_math.cpp │ │ ├── amp_math_sqrtf.cpp │ │ ├── amp_math_tan.cpp │ │ ├── amp_math_tan_precise_math.cpp │ │ ├── amp_math_tanf.cpp │ │ ├── amp_math_tanh.cpp │ │ ├── amp_math_tanh_precise_math.cpp │ │ ├── amp_math_tanpi_precise_math.cpp │ │ ├── amp_math_tgamma_precise_math.cpp │ │ ├── amp_math_tgammaf_precise_math.cpp │ │ ├── amp_math_trunc.cpp │ │ ├── amp_math_trunc_precise_math.cpp │ │ └── amp_math_truncf.cpp │ ├── AmpShortVectors │ │ ├── amp_short_vectors_2files.cpp │ │ ├── amp_short_vectors_2files.h │ │ ├── amp_short_vectors_2files_1.cpp │ │ ├── amp_short_vectors_double_3_addon.cpp │ │ ├── amp_short_vectors_float_2_addon.cpp │ │ ├── amp_short_vectors_int_4_addon.cpp │ │ ├── amp_short_vectors_norm.cpp │ │ ├── amp_short_vectors_short_vector_traits.cpp │ │ ├── amp_short_vectors_uint_2_addon.cpp │ │ ├── amp_short_vectors_unorm.cpp │ │ ├── hc_short_vector_device.cpp │ │ ├── hc_short_vector_device2.cpp │ │ ├── hc_short_vector_device3.cpp │ │ └── hc_short_vector_template.cpp │ ├── AsyncPFE │ │ ├── accelerator_view_wait.cpp │ │ ├── accelerator_view_wait2.cpp │ │ ├── accelerator_view_wait3.cpp │ │ ├── async_array_add.cpp │ │ ├── async_array_add_2d.cpp │ │ ├── async_array_add_3d.cpp │ │ ├── async_array_add_4d.cpp │ │ ├── async_array_add_multiple.cpp │ │ ├── async_array_add_multiple_2d.cpp │ │ ├── async_array_add_multiple_3d.cpp │ │ ├── async_array_add_multiple_4d.cpp │ │ ├── async_array_add_multiple_tiled.cpp │ │ ├── async_array_add_multiple_tiled_2d.cpp │ │ ├── async_array_add_multiple_tiled_3d.cpp │ │ ├── async_array_add_then.cpp │ │ ├── async_array_add_tiled.cpp │ │ ├── async_array_add_tiled_2d.cpp │ │ ├── async_array_add_tiled_3d.cpp │ │ ├── async_av_dependent1.cpp │ │ ├── async_av_dependent2.cpp │ │ ├── async_av_dependent3.cpp │ │ ├── async_av_dependent4.cpp │ │ ├── async_av_dependent5.cpp │ │ ├── async_av_dependent6.cpp │ │ ├── async_av_dependent7.cpp │ │ ├── async_av_dependent8.cpp.donotrun │ │ ├── async_av_independent1.cpp │ │ ├── async_av_independent2.cpp │ │ ├── async_av_independent3.cpp │ │ ├── async_av_independent4.cpp │ │ ├── completion_future_wait.cpp │ │ └── completion_future_wait2.cpp │ ├── Atomic │ │ ├── atomic_add_float_global.cpp │ │ ├── atomic_add_float_local.cpp │ │ ├── atomic_add_global.cpp │ │ ├── atomic_add_local.cpp │ │ ├── atomic_and_global.cpp │ │ ├── atomic_and_local.cpp │ │ ├── atomic_compare_exchange_global.cpp │ │ ├── atomic_compare_exchange_local.cpp │ │ ├── atomic_dec_global.cpp │ │ ├── atomic_dec_local.cpp │ │ ├── atomic_exchange_float_global.cpp │ │ ├── atomic_exchange_float_local.cpp │ │ ├── atomic_exchange_global.cpp │ │ ├── atomic_exchange_local.cpp │ │ ├── atomic_inc_global.cpp │ │ ├── atomic_inc_local.cpp │ │ ├── atomic_max_global.cpp │ │ ├── atomic_max_local.cpp │ │ ├── atomic_min_global.cpp │ │ ├── atomic_min_local.cpp │ │ ├── atomic_or_global.cpp │ │ ├── atomic_or_local.cpp │ │ ├── atomic_sub_float_global.cpp │ │ ├── atomic_sub_float_local.cpp │ │ ├── atomic_sub_global.cpp │ │ ├── atomic_sub_local.cpp │ │ ├── atomic_xor_global.cpp │ │ └── atomic_xor_local.cpp │ ├── CXXLangExt │ │ ├── array_array.cpp │ │ ├── array_pointer.cpp │ │ ├── enum.cpp │ │ ├── function_declarator_Varargs.cpp │ │ ├── local_param_ret.cpp │ │ ├── local_param_ret_half-float.cpp │ │ ├── local_param_ret_pointer-to-function.cpp │ │ ├── local_param_ret_pointer.cpp │ │ ├── local_param_ret_ref-to-pointer.cpp │ │ ├── local_param_ret_ref.cpp │ │ ├── local_param_ret_static-local.cpp │ │ ├── statement_asm.cpp │ │ ├── statement_global-variable.cpp │ │ ├── statement_goto_label.cpp │ │ ├── statement_recursion.cpp │ │ ├── struct_class_union.cpp │ │ ├── struct_class_union_bitfields.cpp │ │ ├── struct_class_union_half-float.cpp │ │ ├── struct_class_union_pointer.cpp │ │ ├── struct_class_union_ref.cpp │ │ ├── struct_class_union_unaligned-member.cpp │ │ ├── struct_class_virtual-base-class.cpp │ │ └── tile_static.cpp │ ├── CaptureByCopy │ │ ├── test1.cpp │ │ ├── test2.cpp │ │ ├── test3.cpp │ │ └── test4.cpp │ ├── CaptureByRef │ │ ├── test1.cpp │ │ ├── test10.cpp │ │ ├── test11.cpp │ │ ├── test12.cpp │ │ ├── test13.cpp │ │ ├── test14.cpp │ │ ├── test15.cpp │ │ ├── test2.cpp │ │ ├── test3.cpp │ │ ├── test4.cpp │ │ ├── test5.cpp │ │ ├── test6.cpp │ │ ├── test7.cpp │ │ ├── test8.cpp │ │ └── test9.cpp │ ├── Codegen │ │ ├── barrier_should_not_unwind.cpp │ │ ├── compile_error_for_arraytype.cpp │ │ ├── deser_decl.cpp │ │ ├── deser_decl_support_inheritclass.cpp │ │ ├── deser_def.cpp │ │ ├── deser_def_body.cpp │ │ ├── deser_def_body_compound.cpp │ │ ├── deser_def_body_compound_support_inheritclass.cpp │ │ ├── deser_def_ref.cpp │ │ ├── index_operator_test.cpp │ │ ├── indirect-func-arg.cpp │ │ ├── opt_level0.cpp │ │ ├── opt_level1.cpp │ │ ├── restric_overload.cpp │ │ ├── separate.cpp │ │ ├── separate2.cpp │ │ ├── ser_decl.cpp │ │ ├── ser_decl_ref.cpp │ │ ├── ser_def.cpp │ │ ├── ser_def_body.cpp │ │ ├── ser_def_body_support_inheritclass.cpp │ │ ├── ser_def_body_support_scalar.cpp │ │ ├── signature.cpp │ │ ├── trampoline.cpp │ │ ├── trampoline_byref.cpp │ │ ├── trampoline_name.cpp │ │ ├── tworef.cpp │ │ └── vector_addition_using_array.cpp │ ├── CompilerRT │ │ ├── host_half_conv1.cpp │ │ └── host_half_conv2.cpp │ ├── Copy │ │ └── copy.cpp │ ├── DataContainers │ │ ├── array_view.cpp │ │ ├── array_view_2d.1.cpp │ │ ├── array_view_2d.2.cpp │ │ ├── array_view_2d.3.cpp │ │ └── extent.cpp │ ├── Design │ │ ├── 2d.cpp │ │ ├── 5d.support.cpp │ │ ├── addr_space.cpp │ │ ├── array_view_extent.cpp │ │ ├── array_view_extent_2d.cpp │ │ ├── array_view_extent_2d_tile.cpp │ │ ├── double_lamda_in_one_fuction.cpp │ │ ├── lambda.cpp │ │ ├── lambda_tiled.cpp │ │ ├── lambda_tiled_local.cpp │ │ ├── overload.cpp │ │ ├── pass_by_ref.cpp │ │ ├── quick_prototype_vector_add_using_gmac.cpp │ │ ├── transpose.cpp │ │ └── veccadd3.cpp │ ├── DispatchAql │ │ ├── dispatch_hsa_kernel.cpp │ │ ├── hsacodelib.CPP │ │ ├── hsacodelib.h │ │ └── vcpy_isa.hsaco │ ├── DynamicTileStatic │ │ ├── test1.cpp │ │ ├── test10.cpp │ │ ├── test11.cpp │ │ ├── test12.cpp │ │ ├── test13.cpp │ │ ├── test14.cpp │ │ ├── test15.cpp │ │ ├── test16.cpp │ │ ├── test2.cpp │ │ ├── test3.cpp │ │ ├── test6.cpp │ │ ├── test7.cpp │ │ ├── test8.cpp │ │ └── test9.cpp │ ├── Example │ │ └── gtest_example.cpp │ ├── FilePath │ │ ├── file path_test2.cpp │ │ ├── file_path_test1.cpp │ │ ├── file_path_test3.cpp │ │ └── file_path_test4.cpp │ ├── FunctionCall │ │ └── fcs_saxpy.cpp │ ├── HC │ │ ├── accelerator_get_all_views.cpp │ │ ├── accelerator_get_all_views_mt.cpp │ │ ├── amdgcn_ds_bpermute.cpp │ │ ├── amdgcn_ds_permute.cpp │ │ ├── amdgcn_ds_swizzle_bitmode.cpp │ │ ├── amdgcn_ds_swizzle_qdmode.cpp │ │ ├── amdgcn_wave_rl1.cpp │ │ ├── amdgcn_wave_rr1.cpp │ │ ├── amdgcn_wave_sl1.cpp │ │ ├── amdgcn_wave_sr1.cpp │ │ ├── array_device_pointer.cpp │ │ ├── array_of_short_types.cpp │ │ ├── async_copy.cpp │ │ ├── auto_annotate_attribute.cpp │ │ ├── capture_struct_with_carray_by_copy.cpp │ │ ├── capture_struct_with_carray_by_copy2.cpp │ │ ├── capture_struct_with_carray_by_copy3.cpp │ │ ├── capture_struct_with_carray_by_copy4.cpp │ │ ├── completion_future_is_ready.cpp │ │ ├── create_blocking_marker.cpp │ │ ├── create_blocking_marker2.cpp │ │ ├── create_marker.cpp │ │ ├── create_marker2.cpp │ │ ├── cycle.cpp │ │ ├── cycle2.cpp │ │ ├── early_finalize_1.cpp │ │ ├── execute_order.cpp │ │ ├── get_group_segment_sizes.cpp │ │ ├── get_use_count.cpp │ │ ├── hc_array_cpu_access.cpp │ │ ├── hc_atomic_add_float_global.cpp │ │ ├── hc_atomic_add_float_local.cpp │ │ ├── hc_atomic_add_global.cpp │ │ ├── hc_atomic_add_local.cpp │ │ ├── hc_atomic_and_global.cpp │ │ ├── hc_atomic_and_local.cpp │ │ ├── hc_atomic_compare_exchange_global.cpp │ │ ├── hc_atomic_compare_exchange_local.cpp │ │ ├── hc_atomic_dec_global.cpp │ │ ├── hc_atomic_dec_local.cpp │ │ ├── hc_atomic_exchange_float_global.cpp │ │ ├── hc_atomic_exchange_float_local.cpp │ │ ├── hc_atomic_exchange_global.cpp │ │ ├── hc_atomic_exchange_local.cpp │ │ ├── hc_atomic_inc_global.cpp │ │ ├── hc_atomic_inc_local.cpp │ │ ├── hc_atomic_max_global.cpp │ │ ├── hc_atomic_max_local.cpp │ │ ├── hc_atomic_min_global.cpp │ │ ├── hc_atomic_min_local.cpp │ │ ├── hc_atomic_or_global.cpp │ │ ├── hc_atomic_or_local.cpp │ │ ├── hc_atomic_sub_float_global.cpp │ │ ├── hc_atomic_sub_float_local.cpp │ │ ├── hc_atomic_sub_global.cpp │ │ ├── hc_atomic_sub_local.cpp │ │ ├── hc_atomic_wrapinc_wrapdec.cpp │ │ ├── hc_atomic_xor_global.cpp │ │ ├── hc_atomic_xor_local.cpp │ │ ├── hc_math.cpp │ │ ├── hc_math2.cpp │ │ ├── hc_math3.cpp │ │ ├── host-call-undefined-func.cpp │ │ ├── indivisible_tiled_extent.cpp │ │ ├── kernarg_pool_size.cpp │ │ ├── kernel-call-undefined-func.cpp │ │ ├── mad24.cpp │ │ ├── memcpy_symbol1.cpp │ │ ├── memcpy_symbol2.cpp │ │ ├── memcpy_symbol3.cpp │ │ ├── memcpy_symbol4.cpp │ │ ├── mul24.cpp │ │ ├── multi_acc.cpp │ │ ├── multi_acc2.cpp │ │ ├── multi_acc_array.cpp │ │ ├── multi_acc_array2.cpp │ │ ├── pinned_vector.cpp │ │ ├── placement_new.cpp │ │ ├── pointer_to_different_addrspaces.cpp │ │ ├── queue_priority.cpp │ │ ├── reduction_hc.cpp │ │ ├── reduction_tile_static.cpp │ │ ├── saxpy_array.cpp │ │ ├── saxpy_arrayview.cpp │ │ ├── subword_types.cpp │ │ ├── test2.cpp │ │ ├── test3.cpp │ │ ├── test4.cpp │ │ ├── test5.cpp │ │ ├── test7.cpp │ │ ├── test8.cpp │ │ ├── test9.cpp │ │ ├── test_fp16.cpp │ │ ├── test_i16.cpp │ │ ├── tick.cpp │ │ ├── tick2.cpp │ │ ├── tiled_index_copy_ctor.cpp │ │ ├── ubsan.cpp │ │ ├── wg_register_limit1.cpp │ │ ├── wg_size1.cpp │ │ ├── wg_size2.cpp │ │ ├── wg_size3.cpp │ │ ├── wg_size_unsupported1.cpp │ │ ├── wg_size_unsupported2.cpp │ │ ├── wg_size_unsupported3.cpp │ │ ├── wg_size_unsupported4.cpp │ │ └── zero_extent.cpp │ ├── HSA │ │ ├── functor1.cpp │ │ ├── functor2.cpp │ │ ├── functor3.cpp │ │ ├── functor4.cpp │ │ ├── functor5.cpp │ │ ├── functor6.cpp │ │ ├── list.cpp │ │ ├── list2.cpp │ │ ├── sizeof.cpp │ │ ├── string.cpp │ │ └── volatile_union.cpp │ ├── Indexing │ │ ├── extent.cpp │ │ ├── index.cpp │ │ └── tile_index.cpp │ ├── InlineASM │ │ ├── inline_asm_vaddf32.cpp │ │ └── inline_asm_vmacf32.cpp │ ├── InvalidLambda │ │ ├── empty_lambda2.cpp │ │ └── qq.cpp │ ├── Libcxx │ │ └── cout.cpp │ ├── Lock │ │ ├── lock_host_pointer.cpp │ │ └── unlock_host_pointer.cpp │ ├── Macro │ │ ├── check_hcc.cpp │ │ ├── check_hcc_accelerator.cpp │ │ ├── check_hcc_amp.cpp │ │ ├── check_hcc_cpu.cpp │ │ ├── check_kalmar_cc.cpp │ │ ├── check_kalmar_hc.cpp │ │ ├── preprocess01.cpp │ │ └── preprocess02.cpp │ ├── NamespaceScopeVariables │ │ ├── Inputs │ │ │ ├── shared_object_needs_global.cc │ │ │ ├── shared_object_needs_namespace.cc │ │ │ ├── shared_object_with_global.cc │ │ │ ├── shared_object_with_namespace.cc │ │ │ ├── test_parameters.hpp │ │ │ └── translation_unit.cc │ │ ├── global.cpp │ │ ├── global_different_translation_units.cpp │ │ ├── global_from_shared_object.cpp │ │ ├── global_to_shared_object.cpp │ │ ├── namespace.cpp │ │ ├── namespace_different_translation_units.cpp │ │ ├── namespace_from_shared_object.cpp │ │ └── namespace_to_shared_object.cpp │ ├── Overload │ │ ├── Caller-amp-only-Callee-global-cpu-only.cpp │ │ ├── Disjoint_restrict.cpp │ │ ├── Negative │ │ │ ├── call_amp_function_in_cpu_function_or_lambda_or_pfe.cpp │ │ │ ├── call_amp_function_in_main.cpp │ │ │ ├── call_amp_linking_error.cpp │ │ │ ├── call_cpu_funtion_in_amp_function_or_lambda_or_pfe.cpp │ │ │ ├── call_distinct_from_dual_context.cpp │ │ │ └── linking_error.cpp │ │ ├── Test_Overload.cpp │ │ ├── amp-lambda_or_pfe_in_main.cpp │ │ ├── amp_lambda_or_pfe_in_a_cpu_or_cpu_elided_function_or_lambda.cpp │ │ ├── cpu_caller_distinct_callees.cpp │ │ ├── cpu_function_or_lambda_in_main.cpp │ │ └── cpu_lambda_in_amp_function.cpp │ ├── ParallelSTL │ │ ├── adjacent_difference_carray.cpp │ │ ├── adjacent_difference_predicated_carray.cpp │ │ ├── adjacent_difference_predicated_stdarray.cpp │ │ ├── adjacent_difference_predicated_stdvector.cpp │ │ ├── adjacent_difference_stdarray.cpp │ │ ├── adjacent_difference_stdvector.cpp │ │ ├── adjacent_find_carray.cpp │ │ ├── adjacent_find_stdarray.cpp │ │ ├── adjacent_find_stdvector.cpp │ │ ├── all_any_none_of_carray.cpp │ │ ├── all_any_none_of_stdarray.cpp │ │ ├── all_any_none_of_stdvector.cpp │ │ ├── copy_carray.cpp │ │ ├── copy_if_carray.cpp │ │ ├── copy_if_stdarray.cpp │ │ ├── copy_if_stdvector.cpp │ │ ├── copy_n_carray.cpp │ │ ├── copy_n_stdarray.cpp │ │ ├── copy_n_stdvector.cpp │ │ ├── copy_stdarray.cpp │ │ ├── copy_stdvector.cpp │ │ ├── count_carray.cpp │ │ ├── count_stdarray.cpp │ │ ├── count_stdvector.cpp │ │ ├── equal_carray.cpp │ │ ├── equal_stdarray.cpp │ │ ├── equal_stdvector.cpp │ │ ├── exclusive_scan_carray.cpp │ │ ├── exclusive_scan_stdarray.cpp │ │ ├── exclusive_scan_stdvector.cpp │ │ ├── fill_carray.cpp │ │ ├── fill_n_carray.cpp │ │ ├── fill_n_stdarray.cpp │ │ ├── fill_n_stdvector.cpp │ │ ├── fill_stdarray.cpp │ │ ├── fill_stdvector.cpp │ │ ├── find_carray.cpp │ │ ├── find_end_carray.cpp │ │ ├── find_first_of_carray.cpp.donotrun │ │ ├── find_stdarray.cpp │ │ ├── find_stdvector.cpp │ │ ├── foreach_av_1D.cpp │ │ ├── foreach_av_2D.cpp │ │ ├── foreach_av_3D.cpp │ │ ├── foreach_carray.cpp │ │ ├── foreach_n_av_1D.cpp │ │ ├── foreach_n_av_2D.cpp │ │ ├── foreach_n_av_3D.cpp │ │ ├── foreach_n_carray.cpp │ │ ├── foreach_n_stdarray.cpp │ │ ├── foreach_n_vector.cpp │ │ ├── foreach_stdarray.cpp │ │ ├── foreach_vector.cpp │ │ ├── generate_carray.cpp │ │ ├── generate_n_carray.cpp │ │ ├── generate_n_stdarray.cpp │ │ ├── generate_n_stdvector.cpp │ │ ├── generate_stdarray.cpp │ │ ├── generate_stdvector.cpp │ │ ├── inclusive_scan_carray.cpp │ │ ├── inclusive_scan_stdarray.cpp │ │ ├── inclusive_scan_stdvector.cpp │ │ ├── inner_product_carray.cpp │ │ ├── inner_product_stdarray.cpp │ │ ├── inner_product_stdvector.cpp │ │ ├── is_partitioned_carray.cpp.donotrun │ │ ├── lexicographical_compare_carray.cpp │ │ ├── max_element_carray.cpp │ │ ├── max_element_stdarray.cpp │ │ ├── max_element_stdvector.cpp │ │ ├── min_element_carray.cpp │ │ ├── min_element_stdarray.cpp │ │ ├── min_element_stdvector.cpp │ │ ├── minmax_element_carray.cpp │ │ ├── minmax_element_stdarray.cpp │ │ ├── minmax_element_stdvector.cpp │ │ ├── mismatch_carray.cpp │ │ ├── mismatch_stdarray.cpp │ │ ├── mismatch_stdvector.cpp │ │ ├── partition_carray.cpp │ │ ├── partition_copy_carray.cpp │ │ ├── partition_stdarray.cpp │ │ ├── partition_stdvector.cpp │ │ ├── reduce_carray.cpp │ │ ├── reduce_stdarray.cpp │ │ ├── reduce_stdvector.cpp │ │ ├── replace_carray.cpp │ │ ├── replace_copy_carray.cpp │ │ ├── replace_copy_if_carray.cpp │ │ ├── replace_copy_if_stdarray.cpp │ │ ├── replace_copy_if_stdvector.cpp │ │ ├── replace_copy_stdarray.cpp │ │ ├── replace_copy_stdvector.cpp │ │ ├── replace_if_carray.cpp │ │ ├── replace_stdarray.cpp │ │ ├── replace_stdvector.cpp │ │ ├── reverse_carray.cpp │ │ ├── reverse_copy_carray.cpp │ │ ├── reverse_copy_stdarray.cpp │ │ ├── reverse_copy_stdvector.cpp │ │ ├── reverse_stdarray.cpp │ │ ├── reverse_stdvector.cpp │ │ ├── search_carray.cpp │ │ ├── search_n_carray.cpp │ │ ├── sort_carray.cpp │ │ ├── sort_stdarray.cpp │ │ ├── sort_stdvector.cpp │ │ ├── stable_partition_carray.cpp │ │ ├── stable_partition_stdarray.cpp │ │ ├── stable_partition_stdvector.cpp │ │ ├── stablesort_carray.cpp │ │ ├── stablesort_stdarray.cpp │ │ ├── stablesort_stdvector.cpp │ │ ├── swap_ranges_carray.cpp │ │ ├── test_base.h │ │ ├── transform_binary_carray.cpp │ │ ├── transform_binary_stdarray.cpp │ │ ├── transform_binary_stdvector.cpp │ │ ├── transform_carray.cpp │ │ ├── transform_exclusive_scan_carray.cpp.donotrun │ │ ├── transform_exclusive_scan_stdarray.cpp.donotrun │ │ ├── transform_exclusive_scan_stdvector.cpp.donotrun │ │ ├── transform_inclusive_scan_carray.cpp.donotrun │ │ ├── transform_inclusive_scan_stdarray.cpp.donotrun │ │ ├── transform_inclusive_scan_stdvector.cpp.donotrun │ │ ├── transform_reduce_carray.cpp │ │ ├── transform_stdarray.cpp │ │ ├── transform_stdvector.cpp │ │ ├── unique_carray.cpp │ │ └── unique_copy_carray.cpp │ ├── Parse │ │ ├── amp_header_test.cpp │ │ ├── class_cross_referencing.cpp │ │ ├── function_declarator.cpp │ │ ├── lambda_attribute.cpp │ │ ├── lambda_attribute_hc.cpp │ │ ├── lambda_expr.amp.cpp │ │ ├── lambda_expr.both.cpp │ │ ├── lambda_expr.cpu.cpp │ │ ├── lambda_expr.cpu_only.cpp │ │ ├── lambda_expr.mixed.cpp │ │ ├── lambda_expr.recursive.cpp │ │ ├── lambda_expr.without.params.cpp │ │ └── method_declarator.cpp │ ├── PlatformAtomics │ │ ├── atomic_int.cpp │ │ ├── pingpong.cpp │ │ ├── sync_1way.cpp │ │ ├── sync_2way.cpp │ │ └── syscall.cpp │ ├── Pool │ │ ├── accelerator_get_compute_unit_count_api.cpp │ │ ├── accelerator_get_is_peer_api.cpp │ │ ├── accelerator_get_is_peer_cpu1.cpp │ │ ├── accelerator_get_is_peer_cpu2.cpp │ │ ├── accelerator_get_peers.cpp │ │ ├── accelerator_view_set_cu_mask.cpp │ │ ├── map_to_peers_device_ptr.cpp │ │ └── map_to_peers_host_ptr.cpp │ ├── Printf │ │ ├── lit.local.cfg │ │ ├── no_printf.cpp │ │ ├── printf.cpp │ │ ├── printf_error_check.cpp │ │ ├── printf_excess_args.cpp │ │ ├── printf_minimal.cpp │ │ ├── printf_ptr_addr.cpp │ │ └── printf_supported_types.cpp │ ├── RawGenericPointer │ │ ├── array_add_am.cpp │ │ ├── array_add_am10.cpp │ │ ├── array_add_am11.cpp │ │ ├── array_add_am12.cpp │ │ ├── array_add_am13.cpp │ │ ├── array_add_am14.cpp │ │ ├── array_add_am15.cpp │ │ ├── array_add_am16.cpp │ │ ├── array_add_am17.cpp │ │ ├── array_add_am2.cpp │ │ ├── array_add_am3.cpp │ │ ├── array_add_am4.cpp │ │ ├── array_add_am5.cpp │ │ ├── array_add_am6.cpp │ │ ├── array_add_am7.cpp │ │ ├── array_add_am8.cpp │ │ └── array_add_am9.cpp │ ├── RawPointer │ │ └── array_add.cpp │ ├── RestrictionSpecifier │ │ ├── Negative │ │ │ ├── empty_restriction.cpp │ │ │ ├── id_is_unrecognized.cpp │ │ │ ├── non-comma_between_ids.cpp │ │ │ ├── non-id_at_two_ends.cpp │ │ │ ├── should_not_parse.cpp │ │ │ └── space.cpp │ │ ├── OKCase.cpp │ │ └── Override_Qualifier.cpp │ ├── SemaHCC │ │ └── global-array.cpp │ ├── SharedLibrary │ │ ├── shared_library1.cpp │ │ ├── shared_library2.cpp │ │ ├── shared_library3.cpp │ │ ├── shared_library4.cpp │ │ └── shared_library5.cpp │ ├── StaticLibrary │ │ ├── static_library1.cpp │ │ ├── static_library2.cpp │ │ ├── static_library3.cpp │ │ └── static_library4.cpp │ ├── Template │ │ └── Specialization_Inheritate_Restrictions.cpp.timesout │ └── decltype │ │ └── TrailingReturn.cpp ├── known_failures ├── lit.cfg └── lit.site.cfg.in └── utils ├── CMakeLists.txt └── gtest ├── CMakeLists.txt ├── gtest-all.cc ├── gtest.h └── gtest_main.cc /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "rocdl"] 2 | path = rocdl 3 | url = http://github.com/RadeonOpenCompute/ROCm-Device-Libs.git 4 | branch = master 5 | [submodule "llvm-project"] 6 | path = llvm-project 7 | url = https://github.com/RadeonOpenCompute/llvm-project 8 | branch = amd-stg-open-hcc 9 | -------------------------------------------------------------------------------- /benchmarks/benchEmptyKernel/Makefile: -------------------------------------------------------------------------------- 1 | # run kernel # of times 2 | N := 500000 3 | 4 | # TODO - should enable OPT=-O3 for benchmarking. 5 | OPT=-O3 6 | 7 | ROCM_PATH=/opt/rocm 8 | 9 | SOURCES=bench.cpp 10 | EX_SOURCES=statutils.CPP hsacodelib.CPP 11 | 12 | OBJECTS=$(SOURCES:.cpp=.o) $(EX_SOURCES:.CPP=.o) 13 | 14 | 15 | bench: $(OBJECTS) nullkernel 16 | hcc `hcc-config --build --ldflags` $(OPT) $(OBJECTS) -o bench -L$(ROCM_PATH)/lib -lhsa-runtime64 17 | 18 | %.o: %.CPP 19 | hcc `hcc-config --build --cxxflags` $(OPT) -I$(ROCM_PATH)/include $< -c -o $@ 20 | 21 | %.o: %.cpp 22 | hcc `hcc-config --build --cxxflags` $(OPT) -I$(ROCM_PATH)/include $< -c -o $@ 23 | 24 | nullkernel: nullkernel.cpp 25 | hcc `hcc-config --build --cxxflags --ldflags --shared` $< -o $@ 26 | extractkernel -i nullkernel 27 | 28 | plot: bench 29 | ./bench ${N} 30 | gnuplot plot.plt 31 | @echo 32 | @echo "Done, please check the svg files." 33 | 34 | clean: 35 | rm -f bench *.o nullkernel *.bundle *.hsaco *.isa 36 | 37 | 38 | .PHONY: clean plot 39 | -------------------------------------------------------------------------------- /benchmarks/benchEmptyKernel/README: -------------------------------------------------------------------------------- 1 | - Note : use "CPP" suffix to hide some files from LIT. 2 | - 3 | -------------------------------------------------------------------------------- /benchmarks/benchEmptyKernel/hsacodelib.h: -------------------------------------------------------------------------------- 1 | struct grid_launch_parm; 2 | 3 | struct Kernel { 4 | uint64_t _kernelCodeHandle; 5 | int _groupSegmentSize; 6 | int _privateSegmentSize; 7 | }; 8 | 9 | extern Kernel load_hsaco(hc::accelerator_view *av, const char * fileName, const char *kernelName); 10 | void dispatch_glp_kernel(const grid_launch_parm *lp, const Kernel &k, void *args, int argSize, bool systemScope); 11 | -------------------------------------------------------------------------------- /benchmarks/benchEmptyKernel/nullkernel.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %hc --amdgpu-target=gfx801 --amdgpu-target=gfx802 --amdgpu-target=gfx803 -fPIC -shared %S/nullkernel.cpp -o %T/nullkernel 2 | // RUN: HCC_HOME=%llvm_libs_dir/../../ %extractkernel -i %T/nullkernel 3 | 4 | #include "hc.hpp" 5 | #include "grid_launch.hpp" 6 | 7 | __attribute__((hc_grid_launch)) 8 | void nullkernel(const grid_launch_parm lp, float* Ad) { 9 | if (Ad) { 10 | Ad[0] = 42; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /benchmarks/benchEmptyKernel/plot.plt: -------------------------------------------------------------------------------- 1 | set terminal svg enhanced size 3000 2000 fsize 32 2 | set print "-" 3 | 4 | set xlabel "Iterations" 5 | set ylabel "Time (s)" 6 | set yrange[0.000010:0.000500] 7 | set format y "%.1te%+03T"; 8 | 9 | set output "pfe.svg" 10 | set title "PFE plot" 11 | stats "./pfe.dat" using 2 prefix "A" 12 | plot "./pfe.dat" using 1:2 title "", A_mean title gprintf("Mean = %.5te%+03T s", A_mean) 13 | 14 | set output "grid_launch.svg" 15 | set title "Grid Launch plot" 16 | stats "./grid_launch.dat" using 2 prefix "A" 17 | plot "./grid_launch.dat" using 1:2 title "", A_mean title gprintf("Mean = %.5te%+03T s", A_mean) 18 | -------------------------------------------------------------------------------- /benchmarks/benchEmptyKernel/runbench.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ./bench --dispatch_count 50000 --burst_count 1 $@ 4 | 5 | # burst of kernels: 6 | ./bench --dispatch_count 5000 --burst_count 100 $@ 7 | 8 | # Just the code mode dispatches 9 | ./bench --dispatch_count 5000 --burst_count 100 --tests 0x30 $@ 10 | 11 | 12 | -------------------------------------------------------------------------------- /benchmarks/benchEmptyKernel/statutils.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | extern void plot(const std::string &filename, const std::vector> &data); 8 | extern void remove_outliers(std::vector> &data, 9 | std::vector> &outliers); 10 | void printVecInfo(const std::string &name, const std::vector> &data); 11 | 12 | 13 | template 14 | T average(const std::vector> &data) { 15 | T avg_duration = 0; 16 | 17 | for(auto &i : data) 18 | avg_duration += i.count(); 19 | 20 | return avg_duration/data.size(); 21 | } 22 | -------------------------------------------------------------------------------- /cmake-tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | if(NOT CMAKE_CXX_COMPILER MATCHES ".*hcc") 3 | set(CMAKE_CXX_COMPILER "${PROJECT_BINARY_DIR}/llvm-project/llvm/bin/clang++") 4 | endif() 5 | 6 | add_executable(cmake-test cmake-test.cpp) 7 | 8 | # Explicitly set the GPU architecture so that 9 | # cmake_test could be cross-compiled on a system 10 | # without a GPU 11 | get_target_property(cmake_test_link_flags cmake-test LINK_FLAGS) 12 | if (cmake_test_link_flags) 13 | set(new_cmake_test_link_flags "${cmake_test_link_flags} --amdgpu-target=gfx803 --amdgpu-target=gfx900 --amdgpu-target=gfx906") 14 | else() 15 | set(new_cmake_test_link_flags "--amdgpu-target=gfx803 --amdgpu-target=gfx900 --amdgpu-target=gfx906") 16 | endif() 17 | set_target_properties(cmake-test PROPERTIES LINK_FLAGS ${new_cmake_test_link_flags}) 18 | 19 | if(TARGET hccrt) 20 | add_dependencies(cmake-test clang_links rocdl_links mcwamp) 21 | target_link_libraries(cmake-test hccrt hc_am) 22 | else() 23 | # Append default hcc installation 24 | list(APPEND CMAKE_PREFIX_PATH /opt/rocm) 25 | find_package(hcc) 26 | target_link_libraries(cmake-test ${hcc_LIBRARIES}) 27 | endif() 28 | -------------------------------------------------------------------------------- /cmake-tests/cmake-test.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | int sum(hc::array_view& input) { 9 | 10 | hc::array_view s(1); 11 | s[0]=0; 12 | 13 | hc::parallel_for_each(input.get_extent(), [=](hc::index<1> idx) [[hc]] { 14 | if (idx[0]==0) { 15 | int num = input.get_extent()[0]; 16 | for (int i = 0; i < num; i++) { 17 | s[0]+=input[i]; 18 | } 19 | } 20 | }).wait(); 21 | 22 | return s[0]; 23 | } 24 | 25 | int main() { 26 | 27 | auto acc = hc::accelerator(); 28 | int* data1_d = (int*)hc::am_alloc(256*sizeof(int), acc, 0); 29 | 30 | hc::array_view av(64); 31 | for (int i = 0;i < 64; i++) 32 | av[i] = i; 33 | 34 | int s = std::sqrt(sum(av)); 35 | 36 | std::string ss = std::to_string(s); 37 | std::cout << "sum: " << ss << std::endl; 38 | 39 | // printf("sum: %d\n",s); 40 | 41 | hc::am_free(data1_d); 42 | 43 | return !(s==44); 44 | } 45 | -------------------------------------------------------------------------------- /doc/CppAMPOpenSpecificationV12.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ROCm/hcc/df05d4fda454411e5ccb394796bfa3dbc5136918/doc/CppAMPOpenSpecificationV12.pdf -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2.1' 2 | 3 | services: 4 | hcc-lc-ubuntu-16.04: 5 | build: 6 | context: ./docker 7 | dockerfile: dockerfile-build-ubuntu-16.04 8 | args: 9 | rocm_install_path: /opt/rocm 10 | rocm_build_path: /usr/local/src/hcc-lc 11 | build_type: Release 12 | cmake_prefix: /opt/cmake 13 | cmake_ver_major: 3.7 14 | cmake_ver_minor: 3.7.2 15 | image: hcc-lc-build-ubuntu-16.04 16 | container_name: hcc-lc-build-ubuntu-16.04 17 | 18 | hcc-lc-ubuntu-14.04: 19 | build: 20 | context: ./docker 21 | dockerfile: dockerfile-build-ubuntu-14.04 22 | args: 23 | rocm_install_path: /opt/rocm 24 | rocm_build_path: /usr/local/src/hcc-lc 25 | build_type: Release 26 | cmake_prefix: /opt/cmake 27 | cmake_ver_major: 3.7 28 | cmake_ver_minor: 3.7.2 29 | image: hcc-lc-build-ubuntu-14.04 30 | container_name: hcc-lc-build-ubuntu-14.04 31 | -------------------------------------------------------------------------------- /hc2/headers/functions/integer_computational_basis.hpp: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // 3 | // This file is distributed under the University of Illinois Open Source 4 | // License. See LICENSE.TXT for details. 5 | // 6 | //===----------------------------------------------------------------------===// 7 | #pragma once 8 | 9 | #include 10 | 11 | namespace hc2 12 | { 13 | template< 14 | typename T, 15 | typename std::enable_if{}>::type* = nullptr> 16 | inline 17 | constexpr 18 | bool positive(T x) 19 | { 20 | return x > T{0}; 21 | } 22 | 23 | template< 24 | typename T, 25 | typename std::enable_if{}>::type* = nullptr> 26 | inline 27 | constexpr 28 | bool zero(T x) 29 | { 30 | return x == T{0}; 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /hc2/headers/types/type_support.hpp: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // 3 | // This file is distributed under the University of Illinois Open Source 4 | // License. See LICENSE.TXT for details. 5 | // 6 | //===----------------------------------------------------------------------===// 7 | #pragma once 8 | 9 | namespace hc2 10 | { 11 | template 12 | class Swappable { 13 | friend 14 | inline 15 | void swap(T& x, T& y) { Swappable::swap_(x, y); } 16 | public: 17 | static 18 | void swap_(T& x, T& y) { x.swp_(y); } 19 | }; 20 | } -------------------------------------------------------------------------------- /hcc_config/hcc_config.hxx.in: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #define CMAKE_BUILD_INC_DIR "@HCC_SOURCE_DIR@/include" 3 | #define CMAKE_BUILD_LIB_DIR "@PROJECT_BINARY_DIR@/lib" 4 | #define CMAKE_BUILD_COMPILER_RT_LIB_DIR "@PROJECT_BINARY_DIR@/compiler/lib/clang/6.0.0/lib/linux" 5 | 6 | #define CMAKE_INSTALL_LIB "@CMAKE_INSTALL_LIBDIR@" 7 | 8 | #define CMAKE_ROCM_ROOT "@ROCM_ROOT@" 9 | 10 | #define CMAKE_GTEST_INC_DIR "@PROJECT_SOURCE_DIR@/utils" 11 | -------------------------------------------------------------------------------- /include/experimental/exception_list: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // 3 | // This file is distributed under the University of Illinois Open Source 4 | // License. See LICENSE.TXT for details. 5 | // 6 | //===----------------------------------------------------------------------===// 7 | 8 | /** 9 | * @file exception_list 10 | * exceptions raised during parallel executions 11 | */ 12 | 13 | #pragma once 14 | 15 | namespace std { 16 | namespace experimental { 17 | namespace parallel { 18 | inline namespace v1 { 19 | 20 | #if 0 21 | class exception_list : public exception 22 | { 23 | public: 24 | typedef unspecified iterator; 25 | 26 | size_t size() const noexcept; 27 | iterator begin() const noexcept; 28 | iterator end() const noexcept; 29 | 30 | const char* what() const noexcept override; 31 | }; 32 | #endif 33 | 34 | } // inline namespace v1 35 | } // namespace parallel 36 | } // namespace experimental 37 | } // namespace std 38 | -------------------------------------------------------------------------------- /include/experimental/impl/kernel_launch.inl: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace details { 4 | 5 | // hc kernel invocation 6 | template 7 | inline void kernel_launch(int N, Kernel k, int tile = 0) { 8 | if (tile != 0) { 9 | hc::parallel_for_each(hc::extent<1>(N).tile(tile), k).wait(); 10 | } else { 11 | hc::parallel_for_each(hc::extent<1>(N), k).wait(); 12 | } 13 | } 14 | 15 | } // namespace details 16 | -------------------------------------------------------------------------------- /include/hc_am_internal.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "hc_am.hpp" 4 | 5 | namespace hc { 6 | namespace internal { 7 | 8 | /** 9 | * Allocate a block of size bytes of host coherent system memory. 10 | * 11 | * The contents of the newly allocated block of memory are not initialized. 12 | * 13 | * @return : On success, pointer to the newly allocated memory is returned. 14 | * The pointer is typecast to the desired return type. 15 | * 16 | * If an error occurred trying to allocate the requested memory, nullptr is returned. 17 | * 18 | * Use am_free to free the newly allocated memory. 19 | * 20 | * @see am_free, am_copy 21 | */ 22 | auto_voidp am_alloc_host_coherent(size_t); 23 | 24 | } // namespace internal 25 | } // namespace hc 26 | -------------------------------------------------------------------------------- /include/hc_prof_runtime.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace hc { 4 | // HCC Op IDs enumeration 5 | enum HSAOpId { 6 | HSA_OP_ID_DISPATCH = 0, 7 | HSA_OP_ID_COPY = 1, 8 | HSA_OP_ID_BARRIER = 2, 9 | HSA_OP_ID_NUMBER = 3 10 | }; 11 | }; // namespace hc 12 | 13 | namespace Kalmar { 14 | namespace CLAMP { 15 | // Activity profiling primitives 16 | extern void InitActivityCallback(void* id_callback, void* op_callback, void* arg); 17 | extern bool EnableActivityCallback(uint32_t op, bool enable); 18 | extern const char* GetCmdName(uint32_t id); 19 | } // namespace CLAMP 20 | } // namespace Kalmar 21 | 22 | /** \endcond */ 23 | -------------------------------------------------------------------------------- /include/hc_short_vector.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _HC_SHORT_VECTORS_HPP 4 | #define _HC_SHORT_VECTORS_HPP 5 | 6 | #include 7 | #include 8 | #include "kalmar_serialize.h" 9 | #include "hc_defines.h" 10 | 11 | namespace hc 12 | { 13 | 14 | namespace short_vector 15 | { 16 | 17 | #ifdef __HCC__ 18 | #define __CPU_GPU__ [[cpu]] [[hc]] 19 | #else 20 | #define __CPU_GPU__ 21 | #endif 22 | 23 | #if 1 24 | #include "hc_short_vector.inl" 25 | #else 26 | #include "kalmar_short_vectors.inl" 27 | #endif 28 | 29 | #undef __CPU_GPU__ 30 | 31 | } // namespace short_vector 32 | 33 | } // namespace hc 34 | 35 | #endif // _HC_SHORT_VECTORS_H 36 | -------------------------------------------------------------------------------- /include/hcc_features.hpp: -------------------------------------------------------------------------------- 1 | // Feature flags for HCC capabilities 2 | // 3 | // Intended for HCC users to be able to determine if the HCC version supports a desired feature 4 | // 5 | #pragma once 6 | 7 | // 8 | // If set, am_memtracker_update API accepts appPtr parm 9 | #define __HCC_HAS_EXTENDED_AM_MEMTRACKER_UPDATE (1) 10 | 11 | // Indicate the version of hc::printf being supported 12 | #define __HCC_FEATURE_PRINTF (1) 13 | -------------------------------------------------------------------------------- /lib/clamp-assemble.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # clamp-assemble kernel-bitcode kernel-object 3 | 4 | # enable bash debugging 5 | KMDBSCRIPT="${KMDBSCRIPT:=0}" 6 | if [ $KMDBSCRIPT == "1" ] 7 | then 8 | set -x 9 | fi 10 | 11 | BINDIR=$(dirname $0) 12 | EMBED=$BINDIR/clamp-embed 13 | 14 | # Add error handling functions 15 | . $BINDIR/error-check 16 | 17 | if [ "$#" -ne 3 ]; then 18 | echo "Usage: $0 kernel-bitcode object elf_section_name" >&2 19 | exit_with_code -1 20 | fi 21 | 22 | if [ ! -f "$1" ]; then 23 | echo "kernel-bitcode $1 is not valid" >&2 24 | exit_with_code -1 25 | fi 26 | 27 | if [ -f "$2" ]; then 28 | mv "$2" "$2.host.o" 29 | $EMBED "$1" "$2.kernel.o" "$3" 30 | check_exit_status $EMBED 31 | ld -r "$2.kernel.o" "$2.host.o" -o "$2" 32 | check_exit_status ld 33 | rm "$2.kernel.o" "$2.host.o" 34 | else 35 | $EMBED "$1" "$2" "$3" 36 | check_exit_status $EMBED 37 | fi 38 | 39 | -------------------------------------------------------------------------------- /lib/clamp-embed.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # enable bash debugging 4 | KMDBSCRIPT="${KMDBSCRIPT:=0}" 5 | if [ $KMDBSCRIPT == "1" ] 6 | then 7 | set -x 8 | fi 9 | 10 | # check command line arguments 11 | if [ "$#" -ne 3 ]; then 12 | echo "Usage: $0 input_object output_kernel elf_section_name" >&2 13 | exit 1 14 | fi 15 | 16 | if [ ! -f "$1" ]; then 17 | echo "input object $1 is not valid" >&2 18 | exit 1 19 | fi 20 | 21 | if [[ "@CMAKE_SYSTEM_PROCESSOR@" == "x86_64" ]]; then 22 | objcopy -B i386:x86-64 -I binary -O elf64-x86-64 --rename-section .data="$3" --weaken "$1" "$2" 23 | elif [[ "@CMAKE_SYSTEM_PROCESSOR@" == "aarch64" ]]; then 24 | objcopy -B aarch64 -I binary -O elf64-littleaarch64 --rename-section .data="$3" --weaken "$1" "$2" 25 | elif [[ "@CMAKE_SYSTEM_PROCESSOR@" == "ppc64" ]]; then 26 | objcopy -B ppc64 -I binary -O elf64-powerpc --rename-section .data="$3" --weaken "$1" "$2" 27 | elif [[ "@CMAKE_SYSTEM_PROCESSOR@" == "ppc64le" ]]; then 28 | objcopy -B powerpc -I binary -O elf64-powerpcle --rename-section .data="$3" --weaken "$1" "$2" 29 | fi 30 | -------------------------------------------------------------------------------- /lib/error-check.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Clang Driver requires exit code -1 for failure and -2 for crash 4 | # Report exit code status if non-zero for Linux or kill signal 5 | 6 | check_exit_status () 7 | { 8 | local status="$?" 9 | local signal="" 10 | local orig_msg="${@}" 11 | if [ ${status} -ne 0 ]; then 12 | local src_lineno="${BASH_SOURCE[1]##*/}[${BASH_LINENO[0]}]" 13 | if [ $((${status} < 128)) -ne 0 ]; then 14 | echo "Error: $src_lineno: $orig_msg failed with status $status" 15 | exit -1 16 | else 17 | signal="$(builtin kill -l $((${status} - 128)) 2>/dev/null)" 18 | if [ "$signal" ]; then 19 | echo "Error: $src_lineno: $orig_msg failed by kill signal $signal" 20 | fi 21 | exit -2 22 | fi 23 | fi 24 | return 0; 25 | } 26 | 27 | exit_with_code () 28 | { 29 | local code="${@}" 30 | local src_lineno="${BASH_SOURCE[1]##*/}[${BASH_LINENO[0]}]" 31 | 32 | echo "Error: $src_lineno: failed with status $code" 33 | exit -1 34 | } 35 | -------------------------------------------------------------------------------- /lib/hc-host-assemble.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # hc-host-assemble host-bitcode host-object (options) 4 | 5 | # enable bash debugging 6 | KMDBSCRIPT="${KMDBSCRIPT:=0}" 7 | 8 | # dump the LLVM bitcode 9 | KMDUMPLLVM="${KMDUMPLLVM:=0}" 10 | 11 | if [ $KMDBSCRIPT == "1" ] 12 | then 13 | set -x 14 | fi 15 | 16 | BINDIR=$(dirname "$0") 17 | CLANG=$BINDIR/hcc 18 | OPT=$BINDIR/opt 19 | LLVM_AS=$BINDIR/llvm-as 20 | LLVM_DIS=$BINDIR/llvm-dis 21 | LIBPATH=$BINDIR/../lib 22 | 23 | # Add error handling functions 24 | . $BINDIR/error-check 25 | 26 | if [ "$#" -lt 2 ]; then 27 | echo "Usage: $0 kernel-bitcode object (options)" >&2 28 | exit_with_code -1 29 | fi 30 | 31 | if [ ! -f "$1" ]; then 32 | echo "kernel-bitcode $1 is not valid" >&2 33 | exit_with_code -1 34 | fi 35 | 36 | CXXFLAGS= 37 | # Pass down compiler options 38 | if [ "$#" -ge 2 ]; then 39 | num=2 40 | while [ $num -lt $# ] 41 | do 42 | (( num++ )) 43 | ARG="${!num}" 44 | CXXFLAGS=$CXXFLAGS' '"\"$ARG\"" 45 | done 46 | fi 47 | 48 | CO="-c -o" 49 | 50 | ln -s "$1" "$1.bc" 51 | eval "$CLANG $CXXFLAGS \"$1.bc\" $CO \"$2\" " 52 | check_exit_status "eval $CLANG" 53 | -------------------------------------------------------------------------------- /lib/hsa/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #################### 2 | # HCC runtime (HSA implementation) 3 | #################### 4 | if (HAS_ROCM EQUAL 1) 5 | add_mcwamp_library_hc_am(hc_am hc_am.cpp) 6 | install(TARGETS hc_am 7 | EXPORT hcc-targets 8 | RUNTIME DESTINATION bin 9 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 10 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} 11 | ) 12 | MESSAGE(STATUS "ROCm available, going to build HSA HCC Runtime") 13 | else (HAS_ROCM EQUAL 1) 14 | MESSAGE(STATUS "ROCm NOT available, NOT going to build HSA HCC Runtime") 15 | endif (HAS_ROCM EQUAL 1) 16 | 17 | #################### 18 | # CodeXL Activity Logger Library 19 | #################### 20 | if (USE_CODEXL_ACTIVITY_LOGGER EQUAL 1) 21 | if (CODEXL_ACTIVITY_LOGGER_LIBRARY) 22 | target_link_libraries(hc_am ${CODEXL_ACTIVITY_LOGGER_LIBRARY}/libCXLActivityLogger.so) 23 | endif (CODEXL_ACTIVITY_LOGGER_LIBRARY) 24 | endif (USE_CODEXL_ACTIVITY_LOGGER EQUAL 1) 25 | -------------------------------------------------------------------------------- /lib/mcwamp_impl.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef void* (*PushArgImpl_t)(void *, int, size_t, const void *); 6 | typedef void* (*PushArgPtrImpl_t)(void *, int, size_t, const void *); 7 | typedef void* (*GetContextImpl_t)(); 8 | typedef void (*ShutdownImpl_t)(); 9 | 10 | // Activity profiling routines 11 | typedef void (*InitActivityCallbackImpl_t)(void*, void*, void*); 12 | typedef bool (*EnableActivityCallbackImpl_t)(unsigned, bool); 13 | typedef const char* (*GetCmdNameImpl_t)(unsigned); 14 | -------------------------------------------------------------------------------- /packaging/debian/process_packaging_script.bsh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This is a script to generate the postinst and postrm scripts for the Debian package 4 | # Usage: process_package_script