diff --git a/docs/markdown/hip_rtc.md b/docs/markdown/hip_rtc.md index c3dc66dcae..8edb17ee55 100644 --- a/docs/markdown/hip_rtc.md +++ b/docs/markdown/hip_rtc.md @@ -4,6 +4,12 @@ HIP allows you to compile kernels at runtime with its ```hiprtc*``` APIs. Kernels can be store as a text string and can be passed on to hiprtc APIs alongside options to guide the compilation. +NOTE: + + - This library can be used on systems without HIP install nor AMD GPU driver installed at all (offline compilation). Therefore it does not depend on any HIP runtime library. + - But it does depend on COMGr. We may try to statically link COMGr into hipRTC to avoid any ambiguity. + - Developers can decide to bundle this library with their application. + ## Example To use hiprtc functionality, hiprtc header needs to be included first. ```#include ``` @@ -84,6 +90,9 @@ Please have a look at saxpy.cpp and hiprtcGetLoweredName.cpp files for a detaile ## HIPRTC specific options HIPRTC provides a few hiprtc specific flags - ```--gpu-architecture``` : This flag can guide the code object generation for a specific gpu arch. Example: ```--gpu-architecture=gfx906:sramecc+:xnack-```, its equivalent to ```--offload-arch```. + - This option is compulsory if compilation is done on a system without AMD GPUs supported by HIP runtime. + - Otherwise, hipRTC will load the hip runtime and gather the current device and its architecture info and use it as option. ## Deprecation notice -Users will be required to link to libhiprtc.so/libhiprtc.dll in future releases. Currently all symbols are present in libhipamd64.so/libhipamd64.dll and there is a plan in action to separate HIPRTC APIs from HIP APIs. +Currently HIPRTC APIs are separated from HIP APIs and HIPRTC is available as a separate library libhiprtc.so/libhiprtc.dll. But hiprtc symbols are present in libhipamd64.so/libhipamd64.dll in order to support the existing applications. Gradually, these symbols will be removed from HIP library and applications using HIPRTC will be required to explictly link to HIPRTC library. + diff --git a/tests/catch/unit/rtc/CMakeLists.txt b/tests/catch/unit/rtc/CMakeLists.txt index 6a026cc88d..17eb0baa84 100644 --- a/tests/catch/unit/rtc/CMakeLists.txt +++ b/tests/catch/unit/rtc/CMakeLists.txt @@ -1,16 +1,23 @@ -# AMD Tests +# Common Tests - Test independent of all platforms set(TEST_SRC saxpy.cc warpsize.cc ) +# AMD only tests +set(AMD_TEST_SRC + customOptions.cc +) + if(HIP_PLATFORM MATCHES "nvidia") hip_add_exe_to_target(NAME RTC TEST_SRC ${TEST_SRC} TEST_TARGET_NAME build_tests LINKER_LIBS nvrtc) elseif(HIP_PLATFORM MATCHES "amd") + set(TEST_SRC ${TEST_SRC} ${AMD_TEST_SRC}) hip_add_exe_to_target(NAME RTC TEST_SRC ${TEST_SRC} - TEST_TARGET_NAME build_tests) + TEST_TARGET_NAME build_tests + LINKER_LIBS hiprtc) endif() diff --git a/tests/src/hiprtc/hiprtcGetLoweredName.cpp b/tests/src/hiprtc/hiprtcGetLoweredName.cpp index 562f3aa2a8..8367a7bc8e 100644 --- a/tests/src/hiprtc/hiprtcGetLoweredName.cpp +++ b/tests/src/hiprtc/hiprtcGetLoweredName.cpp @@ -1,5 +1,5 @@ /* -Copyright (c) 2015 - 2021 Advanced Micro Devices, Inc. All rights reserved. +Copyright (c) 2015 - 2022 Advanced Micro Devices, Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* HIT_START - * BUILD: %t %s ../test_common.cpp NVCC_OPTIONS -lnvrtc + * BUILD: %t %s ../test_common.cpp HIPCC_OPTIONS -lhiprtc NVCC_OPTIONS -lnvrtc * TEST: %t * HIT_END */ diff --git a/tests/src/hiprtc/saxpy.cpp b/tests/src/hiprtc/saxpy.cpp index f4acb961b1..241b863341 100644 --- a/tests/src/hiprtc/saxpy.cpp +++ b/tests/src/hiprtc/saxpy.cpp @@ -1,5 +1,5 @@ /* -Copyright (c) 2015 - 2021 Advanced Micro Devices, Inc. All rights reserved. +Copyright (c) 2015 - 2022 Advanced Micro Devices, Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* HIT_START - * BUILD: %t %s ../test_common.cpp NVCC_OPTIONS -lnvrtc + * BUILD: %t %s ../test_common.cpp HIPCC_OPTIONS -lhiprtc NVCC_OPTIONS -lnvrtc * TEST: %t * HIT_END */