summaryrefslogtreecommitdiff
path: root/source/slang/slang-intrinsic-expand.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-10-17 20:14:22 -0700
committerGitHub <noreply@github.com>2024-10-17 20:14:22 -0700
commita618b8c5e249b0f20e6c0c95f9da1b5cbfdbf08b (patch)
treed583c373d574a265fefe7f288a96c4b382e259b8 /source/slang/slang-intrinsic-expand.cpp
parent11e1ecafa09396a3559fe245d729b40ce4f25d52 (diff)
Cleanup atomic intrinsics. (#5324)
* Cleanup atomic intrinsics. * Fix. * Fix glsl. * Remove hacky intrinsic expansion logic for glsl image atomics. * Fix all tests. * Fix. * Add `InterlockedAddF16Emulated`. * Fix glsl intrinsic. * Fix.
Diffstat (limited to 'source/slang/slang-intrinsic-expand.cpp')
-rw-r--r--source/slang/slang-intrinsic-expand.cpp106
1 files changed, 0 insertions, 106 deletions
diff --git a/source/slang/slang-intrinsic-expand.cpp b/source/slang/slang-intrinsic-expand.cpp
index 7cde70777..aabc193dd 100644
--- a/source/slang/slang-intrinsic-expand.cpp
+++ b/source/slang/slang-intrinsic-expand.cpp
@@ -653,112 +653,6 @@ const char* IntrinsicExpandContext::_emitSpecial(const char* cursor)
}
}
break;
-
- case 'a':
- {
- // We have an operation that needs to lower to either
- // `atomic*` or `imageAtomic*` for GLSL, depending on
- // whether its first operand is a subscript into an
- // array. This `$a` is the first `a` in `atomic`,
- // so we will replace it accordingly.
- //
- // TODO: This distinction should be made earlier,
- // with the front-end picking the right overload
- // based on the "address space" of the argument.
-
- Index argIndex = 0;
- SLANG_RELEASE_ASSERT(m_argCount > argIndex);
-
- auto arg = m_args[argIndex].get();
- if (arg->getOp() == kIROp_ImageSubscript)
- {
- m_writer->emit("imageA");
- }
- else
- {
- m_writer->emit("a");
- }
- }
- break;
-
- case 'A':
- {
- // We have an operand that represents the destination
- // of an atomic operation in GLSL, and it should
- // be lowered based on whether it is an ordinary l-value,
- // or an image subscript. In the image subscript case
- // this operand will turn into multiple arguments
- // to the `imageAtomic*` function.
- //
-
- Index argIndex = 0;
- SLANG_RELEASE_ASSERT(m_argCount > argIndex);
-
- auto arg = m_args[argIndex].get();
- if (arg->getOp() == kIROp_ImageSubscript)
- {
- if (m_emitter->getSourceLanguage() == SourceLanguage::GLSL)
- {
- // TODO: we don't handle the multisample
- // case correctly here, where the last
- // component of the image coordinate needs
- // to be broken out into its own argument.
- //
- m_writer->emit("(");
- m_emitter->emitOperand(arg->getOperand(0), getInfo(EmitOp::General));
- m_writer->emit("), ");
-
- // The coordinate argument will have been computed
- // as a `vector<uint, N>` because that is how the
- // HLSL image subscript operations are defined.
- // In contrast, the GLSL `imageAtomic*` operations
- // expect `vector<int, N>` coordinates, so we
- // will hackily insert the conversion here as
- // part of the intrinsic op.
- //
- auto coords = arg->getOperand(1);
- auto coordsType = coords->getDataType();
-
- auto coordsVecType = as<IRVectorType>(coordsType);
- IRIntegerValue elementCount = 1;
- if (coordsVecType)
- {
- coordsType = coordsVecType->getElementType();
- elementCount = getIntVal(coordsVecType->getElementCount());
- }
-
- SLANG_ASSERT(coordsType->getOp() == kIROp_UIntType);
-
- if (elementCount > 1)
- {
- m_writer->emit("ivec");
- m_writer->emit(elementCount);
- }
- else
- {
- m_writer->emit("int");
- }
-
- m_writer->emit("(");
- m_emitter->emitOperand(arg->getOperand(1), getInfo(EmitOp::General));
- m_writer->emit(")");
- }
- else
- {
- m_writer->emit("(");
- m_emitter->emitOperand(arg, getInfo(EmitOp::General));
- m_writer->emit(")");
- }
- }
- else
- {
- m_writer->emit("(");
- m_emitter->emitOperand(arg, getInfo(EmitOp::General));
- m_writer->emit(")");
- }
- }
- break;
-
case 'P':
// Type-based prefix as used for CUDA and C++ targets
{