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());