From cd2a713d63357852fc2dce2b102c43d6ab301282 Mon Sep 17 00:00:00 2001 From: Jason Tang Date: Sun, 17 May 2020 12:57:34 -0400 Subject: [PATCH] Add major/minor/stepping to device layer Change-Id: If82ea55a46b166b243a98089a6e9c40ccfdb479f --- rocclr/device/device.hpp | 4 ++++ rocclr/device/pal/paldevice.cpp | 4 ++++ rocclr/device/rocm/rocblit.cpp | 10 +++++----- rocclr/device/rocm/rocdevice.cpp | 3 +++ 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/rocclr/device/device.hpp b/rocclr/device/device.hpp index 904a96b523..c474d07e30 100644 --- a/rocclr/device/device.hpp +++ b/rocclr/device/device.hpp @@ -460,6 +460,10 @@ struct Info : public amd::EmbeddedObject { uint32_t localMemBanks_; //! The core engine GFXIP version uint32_t gfxipVersion_; + //! The core engine major/minor/stepping + uint32_t gfxipMajor_; + uint32_t gfxipMinor_; + uint32_t gfxipStepping_; //! Number of available async queues uint32_t numAsyncQueues_; //! Number of available real time queues diff --git a/rocclr/device/pal/paldevice.cpp b/rocclr/device/pal/paldevice.cpp index 5953078da7..3e24bb4a83 100644 --- a/rocclr/device/pal/paldevice.cpp +++ b/rocclr/device/pal/paldevice.cpp @@ -666,6 +666,10 @@ void NullDevice::fillDeviceInfo(const Pal::DeviceProperties& palProp, info_.gfxipVersion_ = settings().useLightning_ ? hwInfo()->gfxipVersionLC_ : hwInfo()->gfxipVersion_; + info_.gfxipMajor_ = info_.gfxipVersion_ / 100; + info_.gfxipMinor_ = info_.gfxipVersion_ / 10 % 10; + info_.gfxipStepping_ = info_.gfxipVersion_ % 10; + info_.timeStampFrequency_ = 1000000; info_.numAsyncQueues_ = numComputeRings; diff --git a/rocclr/device/rocm/rocblit.cpp b/rocclr/device/rocm/rocblit.cpp index 031f9652a1..56ed6c3c17 100644 --- a/rocclr/device/rocm/rocblit.cpp +++ b/rocclr/device/rocm/rocblit.cpp @@ -957,7 +957,7 @@ bool KernelBlitManager::copyBufferToImageKernel(device::Memory& srcMemory, amd::Image* srcImage = static_cast(srcMemory.owner()); amd::Image::Format newFormat(dstImage->getImageFormat()); bool swapLayer = - (dstImage->getType() == CL_MEM_OBJECT_IMAGE1D_ARRAY) && (dev().info().gfxipVersion_ >= 1000); + (dstImage->getType() == CL_MEM_OBJECT_IMAGE1D_ARRAY) && (dev().info().gfxipMajor_ >= 10); // Find unsupported formats for (uint i = 0; i < RejectedFormatDataTotal; ++i) { @@ -1149,7 +1149,7 @@ bool KernelBlitManager::copyImageToBufferKernel(device::Memory& srcMemory, amd::Image* srcImage = static_cast(srcMemory.owner()); amd::Image::Format newFormat(srcImage->getImageFormat()); bool swapLayer = - (srcImage->getType() == CL_MEM_OBJECT_IMAGE1D_ARRAY) && (dev().info().gfxipVersion_ >= 1000); + (srcImage->getType() == CL_MEM_OBJECT_IMAGE1D_ARRAY) && (dev().info().gfxipMajor_ >= 10); // Find unsupported formats for (uint i = 0; i < RejectedFormatDataTotal; ++i) { @@ -1387,14 +1387,14 @@ bool KernelBlitManager::copyImage(device::Memory& srcMemory, device::Memory& dst // Program source origin int32_t srcOrg[4] = {(int32_t)srcOrigin[0], (int32_t)srcOrigin[1], (int32_t)srcOrigin[2], 0}; - if ((srcImage->getType() == CL_MEM_OBJECT_IMAGE1D_ARRAY) && (dev().info().gfxipVersion_ >= 1000)) { + if ((srcImage->getType() == CL_MEM_OBJECT_IMAGE1D_ARRAY) && (dev().info().gfxipMajor_ >= 10)) { srcOrg[3] = 1; } setArgument(kernels_[blitType], 2, sizeof(srcOrg), srcOrg); // Program destinaiton origin int32_t dstOrg[4] = {(int32_t)dstOrigin[0], (int32_t)dstOrigin[1], (int32_t)dstOrigin[2], 0}; - if ((dstImage->getType() == CL_MEM_OBJECT_IMAGE1D_ARRAY) && (dev().info().gfxipVersion_ >= 1000)) { + if ((dstImage->getType() == CL_MEM_OBJECT_IMAGE1D_ARRAY) && (dev().info().gfxipMajor_ >= 10)) { dstOrg[3] = 1; } setArgument(kernels_[blitType], 3, sizeof(dstOrg), dstOrg); @@ -2041,7 +2041,7 @@ bool KernelBlitManager::fillImage(device::Memory& memory, const void* pattern, amd::Image* image = static_cast(memory.owner()); amd::Image::Format newFormat(image->getImageFormat()); bool swapLayer = - (image->getType() == CL_MEM_OBJECT_IMAGE1D_ARRAY) && (dev().info().gfxipVersion_ >= 1000); + (image->getType() == CL_MEM_OBJECT_IMAGE1D_ARRAY) && (dev().info().gfxipMajor_ >= 10); // Program the kernels workload depending on the fill dimensions fillType = FillImage; diff --git a/rocclr/device/rocm/rocdevice.cpp b/rocclr/device/rocm/rocdevice.cpp index 9e32b9b6f3..1f867fecbb 100644 --- a/rocclr/device/rocm/rocdevice.cpp +++ b/rocclr/device/rocm/rocdevice.cpp @@ -1439,6 +1439,9 @@ bool Device::populateOCLDeviceConstants() { info_.localMemSizePerCU_ = deviceInfo_.localMemSizePerCU_; info_.localMemBanks_ = deviceInfo_.localMemBanks_; info_.gfxipVersion_ = deviceInfo_.gfxipMajor_ * 100 + deviceInfo_.gfxipMinor_ * 10 + deviceInfo_.gfxipStepping_; + info_.gfxipMajor_ = deviceInfo_.gfxipMajor_; + info_.gfxipMinor_ = deviceInfo_.gfxipMinor_; + info_.gfxipStepping_ = deviceInfo_.gfxipStepping_; info_.numAsyncQueues_ = kMaxAsyncQueues; info_.numRTQueues_ = info_.numAsyncQueues_; info_.numRTCUs_ = info_.maxComputeUnits_;