From 74523f0003609cf9fae4a4bbfe83319843ea8552 Mon Sep 17 00:00:00 2001
From: foreman
Date: Mon, 25 Apr 2016 18:36:37 -0400
Subject: [PATCH] P4 to Git Change 1261640 by gandryey@gera-w8 on 2016/04/25
18:21:12
SWDEV-90482 - [Afterswitch] Interop from OpenGL to OpenCL is broken in one driver and crashes in another
- Make sure SRD resource is reported to OS if program contains static samplers
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.cpp#314 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprogram.hpp#67 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palkernel.cpp#4 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palprogram.hpp#4 edit
[ROCm/clr commit: c484ae9061b3b6c085a32576add37612082d0b3c]
---
projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp | 2 +-
projects/clr/rocclr/runtime/device/gpu/gpuprogram.hpp | 3 +++
projects/clr/rocclr/runtime/device/pal/palkernel.cpp | 2 +-
projects/clr/rocclr/runtime/device/pal/palprogram.hpp | 3 +++
4 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp b/projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp
index ac51292852..50f82b4161 100644
--- a/projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp
+++ b/projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp
@@ -4017,7 +4017,7 @@ HSAILKernel::loadArguments(
memList.push_back(gpu.hsaQueueMem());
}
- if (srdResource) {
+ if (srdResource || prog().isStaticSampler()) {
dev().srds().fillResourceList(memList);
}
diff --git a/projects/clr/rocclr/runtime/device/gpu/gpuprogram.hpp b/projects/clr/rocclr/runtime/device/gpu/gpuprogram.hpp
index 532727e2ca..f5ec739c06 100644
--- a/projects/clr/rocclr/runtime/device/gpu/gpuprogram.hpp
+++ b/projects/clr/rocclr/runtime/device/gpu/gpuprogram.hpp
@@ -528,6 +528,9 @@ public:
//! Returns TRUE if the program just compiled
bool isNull() const { return isNull_; }
+ //! Returns TRUE if the program contains static samplers
+ bool isStaticSampler() const { return (staticSamplers_.size() != 0); }
+
protected:
//! pre-compile setup for GPU
virtual bool initBuild(amd::option::Options* options);
diff --git a/projects/clr/rocclr/runtime/device/pal/palkernel.cpp b/projects/clr/rocclr/runtime/device/pal/palkernel.cpp
index b0ecebae14..7b0e47baad 100644
--- a/projects/clr/rocclr/runtime/device/pal/palkernel.cpp
+++ b/projects/clr/rocclr/runtime/device/pal/palkernel.cpp
@@ -1192,7 +1192,7 @@ HSAILKernel::loadArguments(
memList.push_back(gpu.hsaQueueMem());
}
- if (srdResource) {
+ if (srdResource || prog().isStaticSampler()) {
dev().srds().fillResourceList(memList);
}
diff --git a/projects/clr/rocclr/runtime/device/pal/palprogram.hpp b/projects/clr/rocclr/runtime/device/pal/palprogram.hpp
index 927ec3e7aa..09089723ab 100644
--- a/projects/clr/rocclr/runtime/device/pal/palprogram.hpp
+++ b/projects/clr/rocclr/runtime/device/pal/palprogram.hpp
@@ -193,6 +193,9 @@ public:
//! Returns TRUE if the program just compiled
bool isNull() const { return isNull_; }
+ //! Returns TRUE if the program contains static samplers
+ bool isStaticSampler() const { return (staticSamplers_.size() != 0); }
+
protected:
//! pre-compile setup for GPU
virtual bool initBuild(amd::option::Options* options);