Skip to content

Commit 2199ed4

Browse files
committed
improve RTIP 3.1 check
1 parent 7ceee3b commit 2199ed4

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

hiprt/impl/Compiler.cpp

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,32 @@ namespace hiprt
7474
{
7575
Compiler::Compiler()
7676
{
77-
const std::string src =
78-
"__global__ void rtcTest() { __builtin_amdgcn_image_bvh8_intersect_ray(0, 0.0f, 0xff, { 0.0f, 0.0f, 0.0f "
79-
"}, { 1.0f, 0.0f, 0.0f }, 0, { 0, 0, 0, 0 }, nullptr, nullptr ); }";
77+
if ( UseBitcode || UseBakedCompiledKernel || hiprtcCreateProgram == nullptr || hiprtcCompileProgram == nullptr || hiprtcDestroyProgram == nullptr )
78+
{
79+
// If we use the precompiled bitcode, we won't check RTIP 3.1 support through HIPRTC.
80+
// Or, if the HIP Run Time Compiler is not loaded (e.g. hiprtc0604.dll) , we can't check RTIP 3.1 support.
81+
82+
// We'll assume it's supported, and Context::getRtip is supposed to make extra checks to be sure it's actually supported.
83+
m_rtip31Support = true;
84+
}
85+
else
86+
{
87+
// check the RTIP 3.1 support of the RTC
8088

81-
orortcProgram prog;
82-
checkOrortc( orortcCreateProgram( &prog, src.c_str(), "", 0, nullptr, nullptr ) );
89+
const std::string src =
90+
"__global__ void rtcTest() { __builtin_amdgcn_image_bvh8_intersect_ray(0, 0.0f, 0xff, { 0.0f, 0.0f, 0.0f "
91+
"}, { 1.0f, 0.0f, 0.0f }, 0, { 0, 0, 0, 0 }, nullptr, nullptr ); }";
8392

84-
m_rtip31Support = false;
93+
orortcProgram prog;
94+
checkOrortc( orortcCreateProgram( &prog, src.c_str(), "", 0, nullptr, nullptr ) );
8595

86-
if ( orortcCompileProgram( prog, 0, nullptr ) == ORORTC_SUCCESS )
87-
{
88-
m_rtip31Support = true;
89-
checkOrortc( orortcDestroyProgram( &prog ) );
96+
m_rtip31Support = false;
97+
98+
if ( orortcCompileProgram( prog, 0, nullptr ) == ORORTC_SUCCESS )
99+
{
100+
m_rtip31Support = true;
101+
checkOrortc( orortcDestroyProgram( &prog ) );
102+
}
90103
}
91104
}
92105

hiprt/impl/Context.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ uint32_t Context::getRtip() const
10311031
"utilize HW ray tracing features\n" );
10321032
#endif
10331033

1034-
if ( rtcRtip31 )
1034+
if ( driverRtip31 && rtcRtip31 )
10351035
rtip = 31;
10361036
else
10371037
rtip = 20;

0 commit comments

Comments
 (0)