Skip to content

[DeviceSanitizer] Add assertion to possible nullptr and die when trying to create shadow with unsupported device #19129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@ KernelInfo &AsanInterceptor::getOrCreateKernelInfo(ur_kernel_handle_t Kernel) {
// Create new KernelInfo
auto Program = GetProgram(Kernel);
auto PI = getProgramInfo(Program);
assert(PI != nullptr && "unregistered program!");
bool IsInstrumented = PI->isKernelInstrumented(Kernel);

std::scoped_lock<ur_shared_mutex> Guard(m_KernelMapMutex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ ur_result_t MsanInterceptor::registerSpirKernels(ur_program_handle_t Program) {
}

auto PI = getProgramInfo(Program);
assert(PI != nullptr && "unregistered program!");
for (const auto &SKI : SKInfo) {
if (SKI.Size == 0) {
continue;
Expand Down Expand Up @@ -404,6 +405,7 @@ KernelInfo &MsanInterceptor::getOrCreateKernelInfo(ur_kernel_handle_t Kernel) {

// Create new KernelInfo
auto PI = getProgramInfo(GetProgram(Kernel));
assert(PI != nullptr && "unregistered program!");
auto KI = std::make_unique<KernelInfo>(Kernel);

KI->IsInstrumented = PI->isKernelInstrumented(Kernel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ GetMsanShadowMemory(ur_context_handle_t Context, ur_device_handle_t Device,
static std::shared_ptr<MsanShadowMemory> ShadowDG2 =
std::make_shared<MsanShadowMemoryDG2>(Context, Device);
return ShadowDG2;
} else {
UR_LOG_L(getContext()->logger, ERR, "Unsupport device type");
return nullptr;
}

die("GetMsanShadowMemory: Unsupport device type");
return nullptr;
}

ur_result_t MsanShadowMemoryCPU::Setup() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ std::shared_ptr<ShadowMemory> GetShadowMemory(ur_context_handle_t Context,
return ShadowCPU;
} else if (Type == DeviceType::GPU_PVC) {
return std::make_shared<ShadowMemoryPVC>(Context, Device);
} else {
UR_LOG_L(getContext()->logger, ERR, "Unsupport device type");
return nullptr;
}

die("GetShadowMemory: Unsupport device type");
return nullptr;
}

ur_result_t ShadowMemoryCPU::Setup() {
Expand Down
Loading