| 142 | } // namespace |
| 143 | |
| 144 | spv_result_t TensorLayoutPass(ValidationState_t& _, const Instruction* inst) { |
| 145 | switch (inst->opcode()) { |
| 146 | case spv::Op::OpCreateTensorLayoutNV: |
| 147 | if (auto error = ValidateCreateTensorLayoutNV(_, inst)) return error; |
| 148 | break; |
| 149 | case spv::Op::OpCreateTensorViewNV: |
| 150 | if (auto error = ValidateCreateTensorViewNV(_, inst)) return error; |
| 151 | break; |
| 152 | case spv::Op::OpTensorLayoutSetBlockSizeNV: |
| 153 | case spv::Op::OpTensorLayoutSetDimensionNV: |
| 154 | case spv::Op::OpTensorLayoutSetStrideNV: |
| 155 | if (auto error = ValidateTensorTypeWithDimValuesNV(_, inst, DIM, false)) |
| 156 | return error; |
| 157 | break; |
| 158 | case spv::Op::OpTensorLayoutSliceNV: |
| 159 | if (auto error = ValidateTensorTypeWithDimValuesNV(_, inst, DIMx2, false)) |
| 160 | return error; |
| 161 | break; |
| 162 | case spv::Op::OpTensorLayoutSetClampValueNV: |
| 163 | if (auto error = ValidateTensorTypeWithDimValuesNV(_, inst, ONE, false)) |
| 164 | return error; |
| 165 | break; |
| 166 | case spv::Op::OpTensorViewSetDimensionNV: |
| 167 | case spv::Op::OpTensorViewSetStrideNV: |
| 168 | if (auto error = ValidateTensorTypeWithDimValuesNV(_, inst, DIM, true)) |
| 169 | return error; |
| 170 | break; |
| 171 | case spv::Op::OpTensorViewSetClipNV: |
| 172 | if (auto error = ValidateTensorTypeWithDimValuesNV(_, inst, FOUR, true)) |
| 173 | return error; |
| 174 | break; |
| 175 | default: |
| 176 | break; |
| 177 | } |
| 178 | |
| 179 | return SPV_SUCCESS; |
| 180 | } |
| 181 | |
| 182 | } // namespace val |
| 183 | } // namespace spvtools |
no test coverage detected