From c10d16fa10f5931cdc1c9edff033f45ef0196847 Mon Sep 17 00:00:00 2001
From: foreman
Date: Fri, 20 Dec 2019 11:50:41 -0500
Subject: [PATCH] P4 to Git Change 2049201 by
skudchad@skudchad_test2_win_opencl on 2019/12/20 11:44:13
SWDEV-216708 - [hipclang-vdi-rocm][FBA-77]hipGetDeviceCount() query should not trigger any queue creation.
- KFD queues get created when we call hsa_executable_load_agent_code_object when creating a blitProgram at init. Delay blit creation until when needed
- Queue also gets created when we init a xferQueue. Delay that too until when needed.
If we want to have a lite init, there are multiple changes needed in both OpenCL and HIP. Thats rather a feature to work on later.
ReviewBoardURL = http://ocltc.amd.com/reviews/r/18416/diff/
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocblit.cpp#34 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#148 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.hpp#47 edit
[ROCm/clr commit: 1384e82e6017723cfa4164dbc16fa8711485df88]
---
.../rocclr/runtime/device/rocm/rocblit.cpp | 4 +-
.../rocclr/runtime/device/rocm/rocdevice.cpp | 49 ++++++++++---------
.../rocclr/runtime/device/rocm/rocdevice.hpp | 3 ++
3 files changed, 32 insertions(+), 24 deletions(-)
diff --git a/projects/clr/rocclr/runtime/device/rocm/rocblit.cpp b/projects/clr/rocclr/runtime/device/rocm/rocblit.cpp
index 5704e05b2f..c06a90fbf2 100644
--- a/projects/clr/rocclr/runtime/device/rocm/rocblit.cpp
+++ b/projects/clr/rocclr/runtime/device/rocm/rocblit.cpp
@@ -733,7 +733,9 @@ bool KernelBlitManager::create(amd::Device& device) {
bool KernelBlitManager::createProgram(Device& device) {
if (device.blitProgram() == nullptr) {
- return false;
+ if (!device.createBlitProgram()) {
+ return false;
+ }
}
std::vector devices;
diff --git a/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp b/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp
index 2cc53cd4b8..49eadce97b 100644
--- a/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp
+++ b/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp
@@ -656,18 +656,6 @@ bool Device::create(bool sramEccEnabled) {
return false;
}
- const char* scheduler = nullptr;
-
-#if defined(USE_COMGR_LIBRARY)
- std::string sch = SchedulerSourceCode;
- if (settings().useLightning_) {
- if (info().cooperativeGroups_) {
- sch.append(GwsInitSourceCode);
- }
- scheduler = sch.c_str();
- }
-#endif // USE_COMGR_LIBRARY
-
amd::Context::Info info = {0};
std::vector devices;
devices.push_back(this);
@@ -678,15 +666,6 @@ bool Device::create(bool sramEccEnabled) {
return false;
}
- blitProgram_ = new BlitProgram(context_);
- // Create blit programs
- if (blitProgram_ == nullptr || !blitProgram_->create(this, scheduler)) {
- delete blitProgram_;
- blitProgram_ = nullptr;
- LogError("Couldn't create blit kernels!");
- return false;
- }
-
mapCacheOps_ = new amd::Monitor("Map Cache Lock", true);
if (nullptr == mapCacheOps_) {
return false;
@@ -757,8 +736,6 @@ bool Device::create(bool sramEccEnabled) {
}
}
- xferQueue();
-
return true;
}
@@ -809,6 +786,32 @@ void Device::ReleaseExclusiveGpuAccess(VirtualGPU& vgpu) const {
vgpusAccess().unlock();
}
+bool Device::createBlitProgram() {
+ bool result = true;
+ const char* scheduler = nullptr;
+
+#if defined(USE_COMGR_LIBRARY)
+ std::string sch = SchedulerSourceCode;
+ if (settings().useLightning_) {
+ if (info().cooperativeGroups_) {
+ sch.append(GwsInitSourceCode);
+ }
+ scheduler = sch.c_str();
+ }
+#endif // USE_COMGR_LIBRARY
+
+ blitProgram_ = new BlitProgram(context_);
+ // Create blit programs
+ if (blitProgram_ == nullptr || !blitProgram_->create(this, scheduler)) {
+ delete blitProgram_;
+ blitProgram_ = nullptr;
+ LogError("Couldn't create blit kernels!");
+ return false;
+ }
+
+ return result;
+}
+
device::Program* Device::createProgram(amd::Program& owner, amd::option::Options* options) {
device::Program* program;
if (settings().useLightning_) {
diff --git a/projects/clr/rocclr/runtime/device/rocm/rocdevice.hpp b/projects/clr/rocclr/runtime/device/rocm/rocdevice.hpp
index b257e1cf6d..0e499845d4 100644
--- a/projects/clr/rocclr/runtime/device/rocm/rocdevice.hpp
+++ b/projects/clr/rocclr/runtime/device/rocm/rocdevice.hpp
@@ -380,6 +380,9 @@ class Device : public NullDevice {
amd::Context& context() const { return *context_; }
+ //! Create internal blit program
+ bool createBlitProgram();
+
// Returns AMD GPU Pro interfaces
const IProDevice& iPro() const { return *pro_device_; }
bool ProEna() const { return pro_ena_; }