From adf925d497625ffb6b1cced5b2c39b6262cf43cc Mon Sep 17 00:00:00 2001 From: Jatin Chaudhary <51944368+cjatin@users.noreply.github.com> Date: Thu, 10 Oct 2019 19:59:55 +0530 Subject: [PATCH] Re enable test RTC (#1516) Adding target resolution in hiprtc tests and reenable them. [ROCm/hip commit: 32eb6d3bec8add5b1691e6759a139135e8402026] --- .../hip/tests/src/hiprtc/hiprtcGetLoweredName.cpp | 13 +++++++++++-- projects/hip/tests/src/hiprtc/hiprtcGetTypeName.cpp | 13 +++++++++++-- projects/hip/tests/src/hiprtc/saxpy.cpp | 13 +++++++++++-- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/projects/hip/tests/src/hiprtc/hiprtcGetLoweredName.cpp b/projects/hip/tests/src/hiprtc/hiprtcGetLoweredName.cpp index 8041aa73a3..e7b88d26d2 100644 --- a/projects/hip/tests/src/hiprtc/hiprtcGetLoweredName.cpp +++ b/projects/hip/tests/src/hiprtc/hiprtcGetLoweredName.cpp @@ -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 LINK_OPTIONS hiprtc EXCLUDE_HIP_PLATFORM all + * BUILD: %t %s ../test_common.cpp LINK_OPTIONS hiprtc EXCLUDE_HIP_PLATFORM nvcc * TEST: %t * HIT_END */ @@ -80,7 +80,16 @@ int main() for (auto&& x : variable_name_vec) hiprtcAddNameExpression(prog, x.c_str()); - hiprtcResult compileResult = hiprtcCompileProgram(prog, 0, nullptr); + hipDeviceProp_t props; + int device = 0; + hipGetDeviceProperties(&props, device); + std::string gfxName = "gfx" + std::to_string(props.gcnArch); + std::string sarg = "--gpu-architecture=" + gfxName; + const char* options[] = { + sarg.c_str() + }; + + hiprtcResult compileResult = hiprtcCompileProgram(prog, 1, options); // Obtain compilation log from the program. size_t logSize; diff --git a/projects/hip/tests/src/hiprtc/hiprtcGetTypeName.cpp b/projects/hip/tests/src/hiprtc/hiprtcGetTypeName.cpp index 0263dca28b..812229f81f 100644 --- a/projects/hip/tests/src/hiprtc/hiprtcGetTypeName.cpp +++ b/projects/hip/tests/src/hiprtc/hiprtcGetTypeName.cpp @@ -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 LINK_OPTIONS hiprtc EXCLUDE_HIP_PLATFORM all + * BUILD: %t %s ../test_common.cpp LINK_OPTIONS hiprtc EXCLUDE_HIP_PLATFORM nvcc * TEST: %t * HIT_END */ @@ -76,7 +76,16 @@ int main() for (auto&& x : name_vec) hiprtcAddNameExpression(prog, x.c_str()); - hiprtcResult compileResult = hiprtcCompileProgram(prog, 0, nullptr); + hipDeviceProp_t props; + int device = 0; + hipGetDeviceProperties(&props, device); + std::string gfxName = "gfx" + std::to_string(props.gcnArch); + std::string sarg = "--gpu-architecture=" + gfxName; + const char* options[] = { + sarg.c_str() + }; + + hiprtcResult compileResult = hiprtcCompileProgram(prog, 1, options); size_t logSize; hiprtcGetProgramLogSize(prog, &logSize); diff --git a/projects/hip/tests/src/hiprtc/saxpy.cpp b/projects/hip/tests/src/hiprtc/saxpy.cpp index 268d718b27..191e48b846 100644 --- a/projects/hip/tests/src/hiprtc/saxpy.cpp +++ b/projects/hip/tests/src/hiprtc/saxpy.cpp @@ -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 LINK_OPTIONS hiprtc EXCLUDE_HIP_PLATFORM all + * BUILD: %t %s ../test_common.cpp LINK_OPTIONS hiprtc EXCLUDE_HIP_PLATFORM nvcc * TEST: %t * HIT_END */ @@ -66,7 +66,16 @@ int main() nullptr, // headers nullptr); // includeNames - hiprtcResult compileResult{hiprtcCompileProgram(prog, 0, nullptr)}; + hipDeviceProp_t props; + int device = 0; + hipGetDeviceProperties(&props, device); + std::string gfxName = "gfx" + std::to_string(props.gcnArch); + std::string sarg = "--gpu-architecture=" + gfxName; + const char* options[] = { + sarg.c_str() + }; + + hiprtcResult compileResult{hiprtcCompileProgram(prog, 1, options)}; size_t logSize; hiprtcGetProgramLogSize(prog, &logSize);