summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/slang/core.meta.slang14
-rw-r--r--source/slang/hlsl.meta.slang114
-rw-r--r--source/slang/slang-compiler.cpp11
-rwxr-xr-xsource/slang/slang-compiler.h7
-rw-r--r--source/slang/slang-emit-glsl.cpp15
-rw-r--r--source/slang/slang-emit-spirv.cpp3
-rw-r--r--source/slang/slang-ir-autodiff-fwd.cpp1
-rw-r--r--source/slang/slang-ir-inst-defs.h2
-rw-r--r--source/slang/slang-ir-insts.h6
-rw-r--r--source/slang/slang-ir-peephole.cpp4
-rw-r--r--source/slang/slang-options.cpp7
-rw-r--r--source/slang/slang.cpp5
12 files changed, 157 insertions, 32 deletions
diff --git a/source/slang/core.meta.slang b/source/slang/core.meta.slang
index 3df11fffe..3ebb77f03 100644
--- a/source/slang/core.meta.slang
+++ b/source/slang/core.meta.slang
@@ -217,6 +217,9 @@ attribute_syntax [Differentiable(order:int = 0)] : BackwardDifferentiableAttribu
__intrinsic_op($(kIROp_RequirePrelude))
void __requirePrelude(constexpr String preludeText);
+__intrinsic_op($(kIROp_RequireGLSLExtension))
+void __requireGLSLExtension(constexpr String preludeText);
+
/// Interface to denote types as differentiable.
/// Allows for user-specified differential types as
/// well as automatic generation, for when the associated type
@@ -2255,6 +2258,10 @@ __intrinsic_op($(kIROp_IsFloat))
bool __isFloat_impl(T t);
__generic<T>
+__intrinsic_op($(kIROp_IsHalf))
+bool __isHalf_impl(T t);
+
+__generic<T>
[__unsafeForceInlineEarly]
bool __isFloat()
{
@@ -2262,6 +2269,13 @@ bool __isFloat()
}
__generic<T>
+[__unsafeForceInlineEarly]
+bool __isHalf()
+{
+ return __isHalf_impl(__declVal<T>());
+}
+
+__generic<T>
__intrinsic_op($(kIROp_IsUnsignedInt))
bool __isUnsignedInt_impl(T t);
diff --git a/source/slang/hlsl.meta.slang b/source/slang/hlsl.meta.slang
index 2900d6ea0..0b60bda0d 100644
--- a/source/slang/hlsl.meta.slang
+++ b/source/slang/hlsl.meta.slang
@@ -1778,8 +1778,8 @@ float __atomicAdd(__ref float value, float amount)
}
__glsl_version(430)
-__glsl_extension(GL_EXT_shader_atomic_float2)
-half __atomicAdd(__ref half value, half amount)
+__glsl_extension(GL_NV_shader_atomic_fp16_vector)
+half2 __atomicAdd(__ref half2 value, half2 amount)
{
__target_switch
{
@@ -1787,9 +1787,9 @@ half __atomicAdd(__ref half value, half amount)
case spirv:
return spirv_asm
{
- OpExtension "SPV_EXT_shader_atomic_float16_add";
- OpCapability AtomicFloat16AddEXT;
- result:$$half = OpAtomicFAddEXT &value Device None $amount
+ OpExtension "SPV_EXT_shader_atomic_float_add";
+ OpCapability AtomicFloat32AddEXT;
+ result:$$half2 = OpAtomicFAddEXT &value Device None $amount
};
}
}
@@ -2337,7 +2337,7 @@ ${{{{
__target_switch
{
case hlsl:
- __intrinsic_asm "NvInterlockedAddFp32($0, $1, $2))";
+ __intrinsic_asm "NvInterlockedAddFp16x2($0, $1, $2))";
}
}
@@ -2364,8 +2364,15 @@ ${{{{
case glsl:
case spirv:
{
- let buf = __getEquivalentStructuredBuffer<half>(this);
- originalValue = __atomicAdd(buf[byteAddress / 2], value);
+ let buf = __getEquivalentStructuredBuffer<half2>(this);
+ if ((byteAddress & 2) == 0)
+ {
+ originalValue = __atomicAdd(buf[byteAddress/4], half2(value, half(0.0))).x;
+ }
+ else
+ {
+ originalValue = __atomicAdd(buf[byteAddress/4], half2(half(0.0), value)).y;
+ }
return;
}
}
@@ -7555,6 +7562,9 @@ __target_intrinsic(cuda, "_waveProductMultiple($0, $1)")
__target_intrinsic(hlsl, "WaveActiveProduct($1)")
matrix<T,N,M> WaveMaskProduct(WaveMask mask, matrix<T,N,M> expr);
+__intrinsic_op($(kIROp_RequireGLSLExtension))
+void __requireGLSLExtension(String extensionName);
+
__generic<T : __BuiltinArithmeticType>
__glsl_extension(GL_KHR_shader_subgroup_arithmetic)
__spirv_version(1.3)
@@ -7562,7 +7572,9 @@ T WaveMaskSum(WaveMask mask, T expr)
{
__target_switch
{
- case glsl: __intrinsic_asm "subgroupAdd($1)";
+ case glsl:
+ if (__isHalf<T>()) __requireGLSLExtension("GL_EXT_shader_subgroup_extended_types_float16");
+ __intrinsic_asm "subgroupAdd($1)";
case cuda: __intrinsic_asm "_waveSum($0, $1)";
case hlsl: __intrinsic_asm "WaveActiveSum($1)";
case spirv:
@@ -7591,7 +7603,9 @@ vector<T,N> WaveMaskSum(WaveMask mask, vector<T,N> expr)
{
__target_switch
{
- case glsl: __intrinsic_asm "subgroupAdd($1)";
+ case glsl:
+ if (__isHalf<T>()) __requireGLSLExtension("GL_EXT_shader_subgroup_extended_types_float16");
+ __intrinsic_asm "subgroupAdd($1)";
case cuda: __intrinsic_asm "_waveSumMultiple($0, $1)";
case hlsl: __intrinsic_asm "WaveActiveSum($1)";
case spirv:
@@ -7627,6 +7641,7 @@ bool WaveMaskAllEqual(WaveMask mask, T value)
__target_switch
{
case glsl:
+ if (__isHalf<T>()) __requireGLSLExtension("GL_EXT_shader_subgroup_extended_types_float16");
__intrinsic_asm "subgroupAllEqual($1)";
case hlsl:
__intrinsic_asm "WaveActiveAllEqual($1)";
@@ -7651,6 +7666,7 @@ bool WaveMaskAllEqual(WaveMask mask, vector<T,N> value)
__target_switch
{
case glsl:
+ if (__isHalf<T>()) __requireGLSLExtension("GL_EXT_shader_subgroup_extended_types_float16");
__intrinsic_asm "subgroupAllEqual($1)";
case hlsl:
__intrinsic_asm "WaveActiveAllEqual($1)";
@@ -7681,7 +7697,9 @@ T WaveMaskPrefixProduct(WaveMask mask, T expr)
{
__target_switch
{
- case glsl: __intrinsic_asm "subgroupExclusiveMul($1)";
+ case glsl:
+ if (__isHalf<T>()) __requireGLSLExtension("GL_EXT_shader_subgroup_extended_types_float16");
+ __intrinsic_asm "subgroupExclusiveMul($1)";
case cuda: __intrinsic_asm "_wavePrefixProduct($0, $1)";
case hlsl: __intrinsic_asm "WavePrefixProduct($1)";
case spirv:
@@ -7710,7 +7728,9 @@ vector<T,N> WaveMaskPrefixProduct(WaveMask mask, vector<T,N> expr)
{
__target_switch
{
- case glsl: __intrinsic_asm "subgroupExclusiveMul($1)";
+ case glsl:
+ if (__isHalf<T>()) __requireGLSLExtension("GL_EXT_shader_subgroup_extended_types_float16");
+ __intrinsic_asm "subgroupExclusiveMul($1)";
case cuda: __intrinsic_asm "_wavePrefixProductMultiple($0, $1)";
case hlsl: __intrinsic_asm "WavePrefixProduct($1)";
case spirv:
@@ -7744,7 +7764,9 @@ T WaveMaskPrefixSum(WaveMask mask, T expr)
{
__target_switch
{
- case glsl: __intrinsic_asm "subgroupExclusiveAdd($1)";
+ case glsl:
+ if (__isHalf<T>()) __requireGLSLExtension("GL_EXT_shader_subgroup_extended_types_float16");
+ __intrinsic_asm "subgroupExclusiveAdd($1)";
case cuda: __intrinsic_asm "_wavePrefixSum($0, $1)";
case hlsl: __intrinsic_asm "WavePrefixSum($1)";
case spirv:
@@ -7774,7 +7796,9 @@ vector<T,N> WaveMaskPrefixSum(WaveMask mask, vector<T,N> expr)
{
__target_switch
{
- case glsl: __intrinsic_asm "subgroupExclusiveAdd($1)";
+ case glsl:
+ if (__isHalf<T>()) __requireGLSLExtension("GL_EXT_shader_subgroup_extended_types_float16");
+ __intrinsic_asm "subgroupExclusiveAdd($1)";
case cuda: __intrinsic_asm "_wavePrefixSumMultiple($0, $1)";
case hlsl: __intrinsic_asm "WavePrefixSum($1)";
case spirv:
@@ -8281,7 +8305,9 @@ T WaveActive$(opName.hlslName)(T expr)
{
__target_switch
{
- case glsl: __intrinsic_asm "subgroup$(opName.glslName)($0)";
+ case glsl:
+ if (__isHalf<T>()) __requireGLSLExtension("GL_EXT_shader_subgroup_extended_types_float16");
+ __intrinsic_asm "subgroup$(opName.glslName)($0)";
case hlsl: __intrinsic_asm "WaveActive$(opName.hlslName)";
case spirv:
if (__isFloat<T>())
@@ -8320,7 +8346,9 @@ vector<T,N> WaveActive$(opName.hlslName)(vector<T,N> expr)
{
__target_switch
{
- case glsl: __intrinsic_asm "subgroup$(opName.glslName)($0)";
+ case glsl:
+ if (__isHalf<T>()) __requireGLSLExtension("GL_EXT_shader_subgroup_extended_types_float16");
+ __intrinsic_asm "subgroup$(opName.glslName)($0)";
case hlsl: __intrinsic_asm "WaveActive$(opName.hlslName)";
case spirv:
if (__isFloat<T>())
@@ -8574,7 +8602,9 @@ T WavePrefixProduct(T expr)
{
__target_switch
{
- case glsl: __intrinsic_asm "subgroupExclusiveMul($0)";
+ case glsl:
+ if (__isHalf<T>()) __requireGLSLExtension("GL_EXT_shader_subgroup_extended_types_float16");
+ __intrinsic_asm "subgroupExclusiveMul($0)";
case hlsl: __intrinsic_asm "WavePrefixProduct";
case spirv:
if (__isFloat<T>())
@@ -8609,7 +8639,9 @@ vector<T,N> WavePrefixProduct(vector<T,N> expr)
{
__target_switch
{
- case glsl: __intrinsic_asm "subgroupExclusiveMul($0)";
+ case glsl:
+ if (__isHalf<T>()) __requireGLSLExtension("GL_EXT_shader_subgroup_extended_types_float16");
+ __intrinsic_asm "subgroupExclusiveMul($0)";
case hlsl: __intrinsic_asm "WavePrefixProduct";
case spirv:
if (__isFloat<T>())
@@ -8647,7 +8679,9 @@ T WavePrefixSum(T expr)
{
__target_switch
{
- case glsl: __intrinsic_asm "subgroupExclusiveAdd($0)";
+ case glsl:
+ if (__isHalf<T>()) __requireGLSLExtension("GL_EXT_shader_subgroup_extended_types_float16");
+ __intrinsic_asm "subgroupExclusiveAdd($0)";
case hlsl: __intrinsic_asm "WavePrefixSum";
case spirv:
if (__isFloat<T>())
@@ -8678,7 +8712,9 @@ vector<T,N> WavePrefixSum(vector<T,N> expr)
{
__target_switch
{
- case glsl: __intrinsic_asm "subgroupExclusiveAdd($0)";
+ case glsl:
+ if (__isHalf<T>()) __requireGLSLExtension("GL_EXT_shader_subgroup_extended_types_float16");
+ __intrinsic_asm "subgroupExclusiveAdd($0)";
case hlsl: __intrinsic_asm "WavePrefixSum";
case spirv:
if (__isFloat<T>())
@@ -8716,7 +8752,9 @@ T WaveReadLaneFirst(T expr)
{
__target_switch
{
- case glsl: __intrinsic_asm "subgroupBroadcastFirst($0)";
+ case glsl:
+ if (__isHalf<T>()) __requireGLSLExtension("GL_EXT_shader_subgroup_extended_types_float16");
+ __intrinsic_asm "subgroupBroadcastFirst($0)";
case hlsl: __intrinsic_asm "WaveReadLaneFirst";
case spirv:
return spirv_asm {OpCapability GroupNonUniformBallot; OpGroupNonUniformBroadcastFirst $$T result Subgroup $expr};
@@ -8732,7 +8770,9 @@ vector<T,N> WaveReadLaneFirst(vector<T,N> expr)
{
__target_switch
{
- case glsl: __intrinsic_asm "subgroupBroadcastFirst($0)";
+ case glsl:
+ if (__isHalf<T>()) __requireGLSLExtension("GL_EXT_shader_subgroup_extended_types_float16");
+ __intrinsic_asm "subgroupBroadcastFirst($0)";
case hlsl: __intrinsic_asm "WaveReadLaneFirst";
case spirv:
return spirv_asm {OpCapability GroupNonUniformBallot; OpGroupNonUniformBroadcastFirst $$vector<T,N> result Subgroup $expr};
@@ -8761,7 +8801,9 @@ T WaveBroadcastLaneAt(T value, constexpr int lane)
{
__target_switch
{
- case glsl: __intrinsic_asm "subgroupBroadcast($0, $1)";
+ case glsl:
+ if (__isHalf<T>()) __requireGLSLExtension("GL_EXT_shader_subgroup_extended_types_float16");
+ __intrinsic_asm "subgroupBroadcast($0, $1)";
case hlsl: __intrinsic_asm "WaveReadLaneAt";
case spirv:
let ulane = uint(lane);
@@ -8778,7 +8820,9 @@ vector<T,N> WaveBroadcastLaneAt(vector<T,N> value, constexpr int lane)
{
__target_switch
{
- case glsl: __intrinsic_asm "subgroupBroadcast($0, $1)";
+ case glsl:
+ if (__isHalf<T>()) __requireGLSLExtension("GL_EXT_shader_subgroup_extended_types_float16");
+ __intrinsic_asm "subgroupBroadcast($0, $1)";
case hlsl: __intrinsic_asm "WaveReadLaneAt";
case spirv:
let ulane = uint(lane);
@@ -8805,7 +8849,9 @@ T WaveReadLaneAt(T value, int lane)
{
__target_switch
{
- case glsl: __intrinsic_asm "subgroupShuffle($0, $1)";
+ case glsl:
+ if (__isHalf<T>()) __requireGLSLExtension("GL_EXT_shader_subgroup_extended_types_float16");
+ __intrinsic_asm "subgroupShuffle($0, $1)";
case hlsl: __intrinsic_asm "WaveReadLaneAt";
case spirv:
let ulane = uint(lane);
@@ -8822,7 +8868,9 @@ vector<T,N> WaveReadLaneAt(vector<T,N> value, int lane)
{
__target_switch
{
- case glsl: __intrinsic_asm "subgroupShuffle($0, $1)";
+ case glsl:
+ if (__isHalf<T>()) __requireGLSLExtension("GL_EXT_shader_subgroup_extended_types_float16");
+ __intrinsic_asm "subgroupShuffle($0, $1)";
case hlsl: __intrinsic_asm "WaveReadLaneAt";
case spirv:
let ulane = uint(lane);
@@ -8850,7 +8898,9 @@ T WaveShuffle(T value, int lane)
{
__target_switch
{
- case glsl: __intrinsic_asm "subgroupShuffle($0, $1)";
+ case glsl:
+ if (__isHalf<T>()) __requireGLSLExtension("GL_EXT_shader_subgroup_extended_types_float16");
+ __intrinsic_asm "subgroupShuffle($0, $1)";
case hlsl: __intrinsic_asm "WaveReadLaneAt";
case spirv:
let ulane = uint(lane);
@@ -8867,7 +8917,9 @@ vector<T,N> WaveShuffle(vector<T,N> value, int lane)
{
__target_switch
{
- case glsl: __intrinsic_asm "subgroupShuffle($0, $1)";
+ case glsl:
+ if (__isHalf<T>()) __requireGLSLExtension("GL_EXT_shader_subgroup_extended_types_float16");
+ __intrinsic_asm "subgroupShuffle($0, $1)";
case hlsl: __intrinsic_asm "WaveReadLaneAt";
case spirv:
let ulane = uint(lane);
@@ -8890,7 +8942,8 @@ uint WavePrefixCountBits(bool value)
{
__target_switch
{
- case glsl: __intrinsic_asm "subgroupBallotExclusiveBitCount(subgroupBallot($0))";
+ case glsl:
+ __intrinsic_asm "subgroupBallotExclusiveBitCount(subgroupBallot($0))";
case hlsl: __intrinsic_asm "WavePrefixCountBits($0)";
case spirv:
return spirv_asm
@@ -8910,7 +8963,8 @@ uint4 WaveGetConvergedMulti()
{
__target_switch
{
- case glsl: __intrinsic_asm "subgroupBallot(true)";
+ case glsl:
+ __intrinsic_asm "subgroupBallot(true)";
case hlsl: __intrinsic_asm "WaveActiveBallot(true)";
case cuda: __intrinsic_asm "make_uint4(__activemask(), 0, 0, 0)";
case spirv:
diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp
index 491655643..fbdb91ac7 100644
--- a/source/slang/slang-compiler.cpp
+++ b/source/slang/slang-compiler.cpp
@@ -2329,6 +2329,17 @@ namespace Slang
return false;
}
+ bool CodeGenContext::shouldSkipSPIRVValidation()
+ {
+ if (auto endToEndReq = isEndToEndCompile())
+ {
+ if (endToEndReq->m_skipSPIRVValidation)
+ return true;
+ }
+
+ return false;
+ }
+
bool CodeGenContext::shouldDumpIR()
{
if (getTargetReq()->getTargetFlags() & SLANG_TARGET_FLAG_DUMP_IR)
diff --git a/source/slang/slang-compiler.h b/source/slang/slang-compiler.h
index a95b5a6bc..18a91f78a 100755
--- a/source/slang/slang-compiler.h
+++ b/source/slang/slang-compiler.h
@@ -2562,6 +2562,8 @@ namespace Slang
bool isSpecializationDisabled();
+ bool shouldSkipSPIRVValidation();
+
SlangResult requireTranslationUnitSourceFiles();
//
@@ -2707,7 +2709,8 @@ namespace Slang
virtual SLANG_NO_THROW void SLANG_MCALL setDebugInfoFormat(SlangDebugInfoFormat format) SLANG_OVERRIDE;
virtual SLANG_NO_THROW void SLANG_MCALL setReportDownstreamTime(bool value) SLANG_OVERRIDE;
virtual SLANG_NO_THROW void SLANG_MCALL setReportPerfBenchmark(bool value) SLANG_OVERRIDE;
-
+ virtual SLANG_NO_THROW void SLANG_MCALL setSkipSPIRVValidation(bool value) SLANG_OVERRIDE;
+
void setHLSLToVulkanLayoutOptions(int targetIndex, HLSLToVulkanLayoutOptions* vulkanLayoutOptions);
EndToEndCompileRequest(
@@ -2759,6 +2762,8 @@ namespace Slang
// If set, will print out compiler performance benchmark results.
bool m_reportPerfBenchmark = false;
+
+ bool m_skipSPIRVValidation = false;
String m_diagnosticOutput;
diff --git a/source/slang/slang-emit-glsl.cpp b/source/slang/slang-emit-glsl.cpp
index 3d3f9687e..a0151133d 100644
--- a/source/slang/slang-emit-glsl.cpp
+++ b/source/slang/slang-emit-glsl.cpp
@@ -2114,6 +2114,21 @@ void GLSLSourceEmitter::handleRequiredCapabilitiesImpl(IRInst* inst)
}
}
+
+ // The function may have IRRequireGLSLExtensionInst in its body. We also need to look for them.
+ auto func = as<IRFunc>(inst);
+ if (!func)
+ return;
+ auto block = func->getFirstBlock();
+ if (!block)
+ return;
+ for (auto childInst : block->getChildren())
+ {
+ if (auto requireGLSLExt = as<IRRequireGLSLExtension>(childInst))
+ {
+ _requireGLSLExtension(requireGLSLExt->getExtensionName());
+ }
+ }
}
static Index _getGLSLVersion(ProfileVersion profile)
diff --git a/source/slang/slang-emit-spirv.cpp b/source/slang/slang-emit-spirv.cpp
index 4e11a7d86..192a40f54 100644
--- a/source/slang/slang-emit-spirv.cpp
+++ b/source/slang/slang-emit-spirv.cpp
@@ -5142,7 +5142,8 @@ SlangResult emitSPIRVFromIR(
StringBuilder runSpirvValEnvVar;
PlatformUtil::getEnvironmentVariable(UnownedStringSlice("SLANG_RUN_SPIRV_VALIDATION"), runSpirvValEnvVar);
- if (runSpirvValEnvVar.getUnownedSlice() == "1")
+ if (runSpirvValEnvVar.getUnownedSlice() == "1"
+ && !codeGenContext->shouldSkipSPIRVValidation())
{
const auto validationResult = debugValidateSPIRV(spirvOut);
// If validation isn't available, don't say it failed, it's just a debug
diff --git a/source/slang/slang-ir-autodiff-fwd.cpp b/source/slang/slang-ir-autodiff-fwd.cpp
index 9d13dafae..632f99480 100644
--- a/source/slang/slang-ir-autodiff-fwd.cpp
+++ b/source/slang/slang-ir-autodiff-fwd.cpp
@@ -1906,6 +1906,7 @@ InstPair ForwardDiffTranscriber::transcribeInstImpl(IRBuilder* builder, IRInst*
case kIROp_DetachDerivative:
case kIROp_GetSequentialID:
case kIROp_GetStringHash:
+ case kIROp_SPIRVAsm:
return transcribeNonDiffInst(builder, origInst);
// A call to createDynamicObject<T>(arbitraryData) cannot provide a diff value,
diff --git a/source/slang/slang-ir-inst-defs.h b/source/slang/slang-ir-inst-defs.h
index ff0b815d4..23fcb3a92 100644
--- a/source/slang/slang-ir-inst-defs.h
+++ b/source/slang/slang-ir-inst-defs.h
@@ -572,6 +572,7 @@ INST_RANGE(Unreachable, MissingReturn, Unreachable)
INST_RANGE(TerminatorInst, Return, Unreachable)
INST(RequirePrelude, RequirePrelude, 1, 0)
+INST(RequireGLSLExtension, RequireGLSLExtension, 1, 0)
// TODO: We should consider splitting the basic arithmetic/comparison
// ops into cases for signed integers, unsigned integers, and floating-point
@@ -1014,6 +1015,7 @@ INST(TypeEquals, TypeEquals, 2, 0)
INST(IsInt, IsInt, 1, 0)
INST(IsBool, IsBool, 1, 0)
INST(IsFloat, IsFloat, 1, 0)
+INST(IsHalf, IsHalf, 1, 0)
INST(IsUnsignedInt, IsUnsignedInt, 1, 0)
INST(IsSignedInt, IsSignedInt, 1, 0)
INST(IsVector, IsVector, 1, 0)
diff --git a/source/slang/slang-ir-insts.h b/source/slang/slang-ir-insts.h
index c8309e3df..6e3821c18 100644
--- a/source/slang/slang-ir-insts.h
+++ b/source/slang/slang-ir-insts.h
@@ -3080,6 +3080,12 @@ struct IRRequirePrelude : IRInst
UnownedStringSlice getPrelude() { return as<IRStringLit>(getOperand(0))->getStringSlice(); }
};
+struct IRRequireGLSLExtension : IRInst
+{
+ IR_LEAF_ISA(RequireGLSLExtension)
+ UnownedStringSlice getExtensionName() { return as<IRStringLit>(getOperand(0))->getStringSlice(); }
+};
+
struct IRBuilderSourceLocRAII;
struct IRBuilder
diff --git a/source/slang/slang-ir-peephole.cpp b/source/slang/slang-ir-peephole.cpp
index 22bcafdf4..fb67c6842 100644
--- a/source/slang/slang-ir-peephole.cpp
+++ b/source/slang/slang-ir-peephole.cpp
@@ -983,6 +983,7 @@ struct PeepholeContext : InstPassBase
}
case kIROp_IsInt:
case kIROp_IsFloat:
+ case kIROp_IsHalf:
case kIROp_IsUnsignedInt:
case kIROp_IsSignedInt:
case kIROp_IsBool:
@@ -1009,6 +1010,9 @@ struct PeepholeContext : InstPassBase
case kIROp_IsFloat:
result = isFloatingType(type);
break;
+ case kIROp_IsHalf:
+ result = type->getOp() == kIROp_HalfType;
+ break;
case kIROp_IsUnsignedInt:
result = isIntegralType(type) && !getIntTypeInfo(type).isSigned;
break;
diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp
index ae6195700..3edc7dfb5 100644
--- a/source/slang/slang-options.cpp
+++ b/source/slang/slang-options.cpp
@@ -74,6 +74,7 @@ enum class OptionKind
EmitIr,
ReportDownstreamTime,
ReportPerfBenchmark,
+ SkipSPIRVValidation,
SourceEmbedStyle,
SourceEmbedName,
@@ -446,6 +447,7 @@ void initCommandOptions(CommandOptions& options)
{ OptionKind::InputFilesRemain, "--", nullptr, "Treat the rest of the command line as input files."},
{ OptionKind::ReportDownstreamTime, "-report-downstream-time", nullptr, "Reports the time spent in the downstream compiler." },
{ OptionKind::ReportPerfBenchmark, "-report-perf-benchmark", nullptr, "Reports compiler performance benchmark results." },
+ { OptionKind::SkipSPIRVValidation, "-skip-spirv-validation", nullptr, "Skips spirv validation." },
{ OptionKind::SourceEmbedStyle, "-source-embed-style", "-source-embed-style <source-embed-style>",
"If source embedding is enabled, defines the style used. When enabled (with any style other than `none`), "
"will write compile results into embeddable source for the target language. "
@@ -1930,6 +1932,11 @@ SlangResult OptionsParser::_parse(
m_compileRequest->setReportPerfBenchmark(true);
break;
}
+ case OptionKind::SkipSPIRVValidation:
+ {
+ m_compileRequest->setSkipSPIRVValidation(true);
+ break;
+ }
case OptionKind::ModuleName:
{
CommandLineArg moduleName;
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index 4ce78ee96..b95b21bb5 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -5143,6 +5143,11 @@ void EndToEndCompileRequest::setReportPerfBenchmark(bool value)
m_reportPerfBenchmark = value;
}
+void EndToEndCompileRequest::setSkipSPIRVValidation(bool value)
+{
+ m_skipSPIRVValidation = value;
+}
+
void EndToEndCompileRequest::setDiagnosticCallback(SlangDiagnosticCallback callback, void const* userData)
{
ComPtr<ISlangWriter> writer(new CallbackWriter(callback, userData, WriterFlag::IsConsole));