diff --git a/projects/clr/hipamd/src/hip_platform.cpp b/projects/clr/hipamd/src/hip_platform.cpp index 207af7cf095f..cf2cf53486b6 100644 --- a/projects/clr/hipamd/src/hip_platform.cpp +++ b/projects/clr/hipamd/src/hip_platform.cpp @@ -718,23 +718,21 @@ hipError_t ihipLaunchKernel(const void* hostFunction, dim3 gridDim, dim3 blockDi const int deviceId = hip::Stream::DeviceId(stream); const auto [hip_error, func] = [&]() -> std::pair { - hipFunction_t f; + hipFunction_t f = nullptr; const hipError_t err = PlatformState::Instance().StatCO().GetFunc(&f, hostFunction, deviceId); - // Propagate specific invalid code object errors - if (err == hipErrorInvalidKernelFile || - err == hipErrorInvalidDeviceFunction || - err == hipErrorInvalidImage || - err == hipErrorNotSupported) { // ROCM_KPACK_ENABLED=OFF - return {err, nullptr}; - } // If successful lookup with valid function, use it if (err == hipSuccess && f) { return {hipSuccess, f}; } - // Fallback: assume it's a hip function type - return {hipSuccess, reinterpret_cast(const_cast(hostFunction))}; + // Only take fallback for hipErrorInvalidSymbol (not in registered table) + if (err == hipErrorInvalidSymbol) { + return {hipSuccess, reinterpret_cast(const_cast(hostFunction))}; + } + + // Propagate all other errors + return {err, nullptr}; }(); if (hip_error != hipSuccess) {