From 37a547cad56e640ccb380cbf828e60ee5249c3da Mon Sep 17 00:00:00 2001 From: foreman Date: Thu, 2 Apr 2015 16:37:11 -0400 Subject: [PATCH] P4 to Git Change 1137201 by skudchad@skudchad_test_win_opencl2 on 2015/04/02 16:27:14 EPR #403782 - IOMMU2/SVM - Enable SCOption_R1200_ENABLE_XNACK whenever IOMMUv2 is supported. - Add "-sc-xnack-iommu" option for compile and link and pass this to SCWrapper in the options string. ReviewBoardURL = http://ocltc.amd.com/reviews/r/7266/diff/ Affected files ... ... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/scwrapper/SI/scStateSI.cpp#30 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/OPTIONS.def#122 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.cpp#282 edit [ROCm/clr commit: 05a38259640c351aef01a1650ca6c298a05b745a] --- projects/clr/rocclr/compiler/lib/utils/OPTIONS.def | 8 ++++++++ projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/projects/clr/rocclr/compiler/lib/utils/OPTIONS.def b/projects/clr/rocclr/compiler/lib/utils/OPTIONS.def index bd6ca39ca5..12af6c4270 100644 --- a/projects/clr/rocclr/compiler/lib/utils/OPTIONS.def +++ b/projects/clr/rocclr/compiler/lib/utils/OPTIONS.def @@ -1105,6 +1105,14 @@ OPTION(OT_BOOL, \ true, 0, 0, NULL, \ "Use AMDAliasAnalysis for correct barrier behavior. If disabled, remove noalias to ensure correct barrier behavior.") +// -sc-xnack-iommu +OPTION(OT_BOOL, \ + OA_RUNTIME|OVIS_SUPPORT|OVA_DISALLOWED|OFA_NORMAL, \ + "sc-xnack-iommu", NULL, \ + SCXnackIommu, \ + false, 0, 0, NULL, \ + "Enable SC XNACK workaround if IOMMUv2 is being used") + // -limit-vector-registers= (default 0 = hardware specific) FLAG(OT_UINT32, OVIS_SUPPORT|OVIS_INTERNAL|OVA_REQUIRED, \ "limit-vector-registers", OptLimitVecRegisters, 0, \ diff --git a/projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp b/projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp index 5c606fd84a..7fb62de2f8 100644 --- a/projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp +++ b/projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp @@ -676,6 +676,12 @@ NullKernel::create( } amd::option::Options* Opts = (amd::option::Options*)bin->options; + + // Append an option so that we can selectively enable a SCOption on CZ + // whenever IOMMUv2 is enabled. + if (nullDev().settings().svmFineGrainSystem_) { + options->origOptionStr.append(" -sc-xnack-iommu"); + } // temporary solution to synchronize buildNo between runtime and complib // until we move runtime inside complib Opts->setBuildNo(options->getBuildNo()); @@ -3557,6 +3563,11 @@ HSAILKernel::init(bool finalize) std::string options(compileOptions_.c_str()); options.append(" -just-kernel="); options.append(openClKernelName.c_str()); + // Append an option so that we can selectively enable a SCOption on CZ + // whenever IOMMUv2 is enabled. + if (dev().settings().svmFineGrainSystem_) { + options.append(" -sc-xnack-iommu"); + } error = aclCompile(dev().hsaCompiler(), prog().binaryElf(), options.c_str(), ACL_TYPE_CG, ACL_TYPE_ISA, NULL); buildLog_ += aclGetCompilerLog(dev().hsaCompiler());