diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2024-11-06 01:47:26 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-05 09:47:26 -0800 |
| commit | b118451e301d734e3e783b3acdf871f3f6ea851c (patch) | |
| tree | 277f160d31e2c442f724bc6a2d3c09fabff403ca /source/slang/slang-emit-torch.cpp | |
| parent | 53dd5928c35d5a5cb1f7d2a563348fd1fa87d672 (diff) | |
Move switch statement bodies to their own lines (#5493)
* Move switch statement bodies to their own lines
* format
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source/slang/slang-emit-torch.cpp')
| -rw-r--r-- | source/slang/slang-emit-torch.cpp | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/source/slang/slang-emit-torch.cpp b/source/slang/slang-emit-torch.cpp index 2da2cf79c..61382961d 100644 --- a/source/slang/slang-emit-torch.cpp +++ b/source/slang/slang-emit-torch.cpp @@ -25,15 +25,33 @@ void emitTorchScalarTypeName(SourceWriter* m_writer, IRInst* type) switch (instType->getOp()) { - case kIROp_FloatType: m_writer->emit("kFloat32"); break; - case kIROp_HalfType: m_writer->emit("kFloat16"); break; - case kIROp_DoubleType: m_writer->emit("kFloat64"); break; - case kIROp_UInt8Type: m_writer->emit("kUInt8"); break; - case kIROp_Int8Type: m_writer->emit("kInt8"); break; - case kIROp_Int16Type: m_writer->emit("kInt16"); break; - case kIROp_IntType: m_writer->emit("kInt32"); break; - case kIROp_Int64Type: m_writer->emit("kInt64"); break; - case kIROp_BoolType: m_writer->emit("kBool"); break; + case kIROp_FloatType: + m_writer->emit("kFloat32"); + break; + case kIROp_HalfType: + m_writer->emit("kFloat16"); + break; + case kIROp_DoubleType: + m_writer->emit("kFloat64"); + break; + case kIROp_UInt8Type: + m_writer->emit("kUInt8"); + break; + case kIROp_Int8Type: + m_writer->emit("kInt8"); + break; + case kIROp_Int16Type: + m_writer->emit("kInt16"); + break; + case kIROp_IntType: + m_writer->emit("kInt32"); + break; + case kIROp_Int64Type: + m_writer->emit("kInt64"); + break; + case kIROp_BoolType: + m_writer->emit("kBool"); + break; default: SLANG_UNEXPECTED((std::string("unknown scalar type in allocTorchTensor: ") + std::string(getIROpInfo(type->getOp()).name)) @@ -46,7 +64,8 @@ bool TorchCppSourceEmitter::tryEmitInstStmtImpl(IRInst* inst) { switch (inst->getOp()) { - default: return false; + default: + return false; case kIROp_CudaKernelLaunch: { m_writer->emit("AT_CUDA_CHECK(cudaLaunchKernel("); @@ -173,7 +192,8 @@ SlangResult TorchCppSourceEmitter::calcTypeName( { switch (type->getOp()) { - default: return Super::calcTypeName(type, target, out); + default: + return Super::calcTypeName(type, target, out); case kIROp_TensorViewType: { out << "TensorView"; |
