Skip to content

Commit

Permalink
nvapi-gpu: Simplify check
Browse files Browse the repository at this point in the history
  • Loading branch information
SveSop authored and jp7677 committed Aug 30, 2024
1 parent 1b653dc commit ae4aeee
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/nvapi_gpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -682,15 +682,10 @@ extern "C" {
if (pGpuInfo == nullptr)
return InvalidArgument(n);

if (pGpuInfo->version != NV_GPU_INFO_VER1 && pGpuInfo->version != NV_GPU_INFO_VER2)
return IncompatibleStructVersion(n, pGpuInfo->version);

auto adapter = reinterpret_cast<NvapiAdapter*>(hPhysicalGpu);
if (!nvapiAdapterRegistry->IsAdapter(adapter))
return ExpectedPhysicalGpuHandle(n);

auto architectureId = adapter->GetArchitectureId();

switch (pGpuInfo->version) {
case NV_GPU_INFO_VER1: {
auto pGpuInfoV1 = reinterpret_cast<NV_GPU_INFO_V1*>(pGpuInfo);
Expand All @@ -701,14 +696,14 @@ extern "C" {
case NV_GPU_INFO_VER2:
*pGpuInfo = {};
pGpuInfo->version = NV_GPU_INFO_VER2;
if (architectureId >= NV_GPU_ARCHITECTURE_TU100) {
if (adapter->GetArchitectureId() >= NV_GPU_ARCHITECTURE_TU100) {
// Values are taken from RTX4080
pGpuInfo->rayTracingCores = 76;
pGpuInfo->tensorCores = 304;
}
break;
default:
return IncompatibleStructVersion(n, pGpuInfo->version); // Actually unreachable
return IncompatibleStructVersion(n, pGpuInfo->version);
}

return Ok(n);
Expand Down

0 comments on commit ae4aeee

Please sign in to comment.