diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td index b628f1a3f7b20..d9a132c1fc792 100644 --- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td +++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td @@ -4233,6 +4233,7 @@ def SPIRV_IsTensorArmType : CPred<"::llvm::isa<::mlir::spirv::TensorArmType>($_s def SPIRV_Void : TypeAlias; def SPIRV_Bool : TypeAlias; def SPIRV_Integer : AnyIntOfWidths<[8, 16, 32, 64]>; +def SPIRV_Int8 : TypeAlias; def SPIRV_Int16 : TypeAlias; def SPIRV_Int32 : TypeAlias; def SPIRV_Float32 : TypeAlias; diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVOps.td index 96ef035eda37a..3ef9699154cd1 100644 --- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVOps.td @@ -45,6 +45,7 @@ include "mlir/Dialect/SPIRV/IR/SPIRVNonUniformOps.td" include "mlir/Dialect/SPIRV/IR/SPIRVPrimitiveOps.td" include "mlir/Dialect/SPIRV/IR/SPIRVCLOps.td" include "mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td" +include "mlir/Dialect/SPIRV/IR/SPIRVTosaOps.td" include "mlir/Interfaces/SideEffectInterfaces.td" #endif // MLIR_DIALECT_SPIRV_IR_OPS diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVTosaOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVTosaOps.td new file mode 100644 index 0000000000000..551c0827dcd5d --- /dev/null +++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVTosaOps.td @@ -0,0 +1,1806 @@ +//===- SPIRVTosaOps.td - TOSA extended insts spec file -----*- tablegen -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This is the op definition spec of TOSA extension ops. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_SPIRV_IR_TOSA_OPS +#define MLIR_DIALECT_SPIRV_IR_TOSA_OPS + +include "mlir/Dialect/SPIRV/IR/SPIRVBase.td" +include "mlir/Dialect/SPIRV/IR/SPIRVGraphOps.td" +include "mlir/Dialect/SPIRV/IR/SPIRVTosaTypes.td" +include "mlir/Interfaces/SideEffectInterfaces.td" + +//===----------------------------------------------------------------------===// +// SPIR-V TOSA opcode specification. +//===----------------------------------------------------------------------===// + +// Base class for all TOSA ops. +class SPIRV_TosaOp traits = []> : + SPIRV_ExtInstOp { + + let availability = [ + MinVersion, + MaxVersion, + Extension<[SPV_ARM_graph, SPV_ARM_tensors]>, + Capability<[SPIRV_C_GraphARM]> + ]; +} + + +def SPIRV_TosaArgMaxOp : SPIRV_TosaOp<"ArgMax", 0, [Pure]> { + let summary = "ArgMax - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_argmax + }]; + + + let arguments = (ins + SPIRV_Int32: $axis, + SPIRV_Int32: $nan_mode, + SPIRV_TosaNumerical_TensorArm1DTo6D: $input + ); + + + let results = (outs + SPIRV_TosaInteger_TensorArmUpTo5D: $output + ); + + let hasVerifier = 1; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaAvgPool2DOp : SPIRV_TosaOp<"AvgPool2D", 1, [Pure]> { + let summary = "AvgPool2D - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_avg_pool2d + }]; + + + let arguments = (ins + SPIRV_Int32_1DTensorArmOfLength2: $kernel, + SPIRV_Int32_1DTensorArmOfLength2: $stride, + SPIRV_Int32_1DTensorArmOfLength4: $pad, + SPIRV_Int32: $acc_type, + SPIRV_TosaNumerical_TensorArm4D: $input, + SPIRV_TosaNumerical_1DTensorArmOfLength1: $input_zp, + SPIRV_TosaNumerical_1DTensorArmOfLength1: $output_zp + ); + + + let results = (outs + SPIRV_TosaNumerical_TensorArm4D: $output + ); + + let hasVerifier = 1; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaConv2DOp : SPIRV_TosaOp<"Conv2D", 2, [Pure]> { + let summary = "Conv2D - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_conv2d + }]; + + + let arguments = (ins + SPIRV_Int32_1DTensorArmOfLength4: $pad, + SPIRV_Int32_1DTensorArmOfLength2: $stride, + SPIRV_Int32_1DTensorArmOfLength2: $dilation, + SPIRV_Int32: $acc_type, + SPIRV_Bool: $local_bound, + SPIRV_TosaNumerical_TensorArm4D: $input, + SPIRV_TosaNumerical_TensorArm4D: $weight, + SPIRV_TosaNumerical_TensorArm1D: $bias, + SPIRV_TosaNumerical_1DTensorArmOfLength1: $input_zp, + SPIRV_TosaNumerical_1DTensorArmOfLength1: $weight_zp + ); + + + let results = (outs + SPIRV_TosaNumerical_TensorArm4D: $output + ); + + let hasVerifier = 1; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaConv3DOp : SPIRV_TosaOp<"Conv3D", 3, [Pure]> { + let summary = "Conv3D - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_conv3d + }]; + + + let arguments = (ins + SPIRV_Int32_1DTensorArmOfLength6: $pad, + SPIRV_Int32_1DTensorArmOfLength3: $stride, + SPIRV_Int32_1DTensorArmOfLength3: $dilation, + SPIRV_Int32: $acc_type, + SPIRV_Bool: $local_bound, + SPIRV_TosaNumerical_TensorArm5D: $input, + SPIRV_TosaNumerical_TensorArm5D: $weight, + SPIRV_TosaNumerical_TensorArm1D: $bias, + SPIRV_TosaNumerical_1DTensorArmOfLength1: $input_zp, + SPIRV_TosaNumerical_1DTensorArmOfLength1: $weight_zp + ); + + + let results = (outs + SPIRV_TosaNumerical_TensorArm5D: $output + ); + + let hasVerifier = 1; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaDepthwiseConv2DOp : SPIRV_TosaOp<"DepthwiseConv2D", 4, [Pure]> { + let summary = "DepthwiseConv2D - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_depthwise_conv2d + }]; + + + let arguments = (ins + SPIRV_Int32_1DTensorArmOfLength4: $pad, + SPIRV_Int32_1DTensorArmOfLength2: $stride, + SPIRV_Int32_1DTensorArmOfLength2: $dilation, + SPIRV_Int32: $acc_type, + SPIRV_Bool: $local_bound, + SPIRV_TosaNumerical_TensorArm4D: $input, + SPIRV_TosaNumerical_TensorArm4D: $weight, + SPIRV_TosaNumerical_TensorArm1D: $bias, + SPIRV_TosaNumerical_1DTensorArmOfLength1: $input_zp, + SPIRV_TosaNumerical_1DTensorArmOfLength1: $weight_zp + ); + + + let results = (outs + SPIRV_TosaNumerical_TensorArm4D: $output + ); + + let hasVerifier = 1; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaFFT2DOp : SPIRV_TosaOp<"FFT2D", 5, [Pure]> { + let summary = "FFT2D - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_fft2d + }]; + + + let arguments = (ins + SPIRV_Bool: $inverse, + SPIRV_Bool: $local_bound, + SPIRV_TosaFloat_TensorArm3D: $input_real, + SPIRV_TosaFloat_TensorArm3D: $input_imag + ); + + + let results = (outs + SPIRV_Struct_2_TosaFloat_TensorArm3D: $output + ); + + let hasVerifier = 1; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaMatMulOp : SPIRV_TosaOp<"MatMul", 6, [Pure]> { + let summary = "MatMul - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_matmul + }]; + + + let arguments = (ins + SPIRV_TosaNumerical_TensorArm3D: $A, + SPIRV_TosaNumerical_TensorArm3D: $B, + SPIRV_TosaNumerical_1DTensorArmOfLength1: $A_zp, + SPIRV_TosaNumerical_1DTensorArmOfLength1: $B_zp + ); + + + let results = (outs + SPIRV_TosaNumerical_TensorArm3D: $output + ); + + let hasVerifier = 1; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaMaxPool2DOp : SPIRV_TosaOp<"MaxPool2D", 7, [Pure]> { + let summary = "MaxPool2D - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_max_pool2d + }]; + + + let arguments = (ins + SPIRV_Int32_1DTensorArmOfLength2: $kernel, + SPIRV_Int32_1DTensorArmOfLength2: $stride, + SPIRV_Int32_1DTensorArmOfLength4: $pad, + SPIRV_Int32: $nan_mode, + SPIRV_TosaNumerical_TensorArm4D: $input + ); + + + let results = (outs + SPIRV_TosaNumerical_TensorArm4D: $output + ); + + let hasVerifier = 1; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaRFFT2DOp : SPIRV_TosaOp<"RFFT2D", 8, [Pure]> { + let summary = "RFFT2D - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_rfft2d + }]; + + + let arguments = (ins + SPIRV_Bool: $local_bound, + SPIRV_TosaFloat_TensorArm3D: $input_real + ); + + + let results = (outs + SPIRV_Struct_2_TosaFloat_TensorArm3D: $output + ); + + let hasVerifier = 1; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaTransposeConv2DOp : SPIRV_TosaOp<"TransposeConv2D", 9, [Pure]> { + let summary = "TransposeConv2D - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_transpose_conv2d + }]; + + + let arguments = (ins + SPIRV_Int32_1DTensorArmOfLength4: $out_pad, + SPIRV_Int32_1DTensorArmOfLength2: $stride, + SPIRV_Int32: $acc_type, + SPIRV_Bool: $local_bound, + SPIRV_TosaNumerical_TensorArm4D: $input, + SPIRV_TosaNumerical_TensorArm4D: $weight, + SPIRV_TosaNumerical_TensorArm1D: $bias, + SPIRV_TosaNumerical_1DTensorArmOfLength1: $input_zp, + SPIRV_TosaNumerical_1DTensorArmOfLength1: $weight_zp + ); + + + let results = (outs + SPIRV_TosaNumerical_TensorArm4D: $output + ); + + let hasVerifier = 1; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaClampOp : SPIRV_TosaOp<"Clamp", 10, [Pure]> { + let summary = "Clamp - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_clamp + }]; + + + let arguments = (ins + SPIRV_TosaNumerical: $min_val, + SPIRV_TosaNumerical: $max_val, + SPIRV_Int32: $nan_mode, + SPIRV_TosaNumerical_TensorArmUpTo6D: $input + ); + + + let results = (outs + SPIRV_TosaNumerical_TensorArmUpTo6D: $output + ); + + let hasVerifier = 1; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaErfOp : SPIRV_TosaOp<"Erf", 11, [Pure]> { + let summary = "Erf - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_erf + }]; + + + let arguments = (ins + SPIRV_TosaFloat_TensorArmUpTo6D: $input + ); + + + let results = (outs + SPIRV_TosaFloat_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaSigmoidOp : SPIRV_TosaOp<"Sigmoid", 12, [Pure]> { + let summary = "Sigmoid - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_sigmoid + }]; + + + let arguments = (ins + SPIRV_TosaFloat_TensorArmUpTo6D: $input + ); + + + let results = (outs + SPIRV_TosaFloat_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaTanhOp : SPIRV_TosaOp<"Tanh", 13, [Pure]> { + let summary = "Tanh - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_tanh + }]; + + + let arguments = (ins + SPIRV_TosaFloat_TensorArmUpTo6D: $input + ); + + + let results = (outs + SPIRV_TosaFloat_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaAddOp : SPIRV_TosaOp<"Add", 14, [Pure]> { + let summary = "Add - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_add + }]; + + + let arguments = (ins + SPIRV_TosaNumerical_TensorArmUpTo6D: $input1, + SPIRV_TosaNumerical_TensorArmUpTo6D: $input2 + ); + + + let results = (outs + SPIRV_TosaNumerical_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaArithmeticRightShiftOp : SPIRV_TosaOp<"ArithmeticRightShift", 15, [Pure]> { + let summary = "ArithmeticRightShift - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_arithmetic_right_shift + }]; + + + let arguments = (ins + SPIRV_Bool: $round, + SPIRV_TosaInteger_TensorArmUpTo6D: $input1, + SPIRV_TosaInteger_TensorArmUpTo6D: $input2 + ); + + + let results = (outs + SPIRV_TosaInteger_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaBitwiseAndOp : SPIRV_TosaOp<"BitwiseAnd", 16, [Pure]> { + let summary = "BitwiseAnd - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_bitwise_and + }]; + + + let arguments = (ins + SPIRV_TosaInteger_TensorArmUpTo6D: $input1, + SPIRV_TosaInteger_TensorArmUpTo6D: $input2 + ); + + + let results = (outs + SPIRV_TosaInteger_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaBitwiseOrOp : SPIRV_TosaOp<"BitwiseOr", 17, [Pure]> { + let summary = "BitwiseOr - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_bitwise_or + }]; + + + let arguments = (ins + SPIRV_TosaInteger_TensorArmUpTo6D: $input1, + SPIRV_TosaInteger_TensorArmUpTo6D: $input2 + ); + + + let results = (outs + SPIRV_TosaInteger_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaBitwiseXorOp : SPIRV_TosaOp<"BitwiseXor", 18, [Pure]> { + let summary = "BitwiseXor - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_bitwise_xor + }]; + + + let arguments = (ins + SPIRV_TosaInteger_TensorArmUpTo6D: $input1, + SPIRV_TosaInteger_TensorArmUpTo6D: $input2 + ); + + + let results = (outs + SPIRV_TosaInteger_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaIntDivOp : SPIRV_TosaOp<"IntDiv", 19, [Pure]> { + let summary = "IntDiv - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_intdiv + }]; + + + let arguments = (ins + SPIRV_TosaInteger_TensorArmUpTo6D: $input1, + SPIRV_TosaInteger_TensorArmUpTo6D: $input2 + ); + + + let results = (outs + SPIRV_TosaInteger_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaLogicalAndOp : SPIRV_TosaOp<"LogicalAnd", 20, [Pure]> { + let summary = "LogicalAnd - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_logical_and + }]; + + + let arguments = (ins + SPIRV_Bool_TensorArmUpTo6D: $input1, + SPIRV_Bool_TensorArmUpTo6D: $input2 + ); + + + let results = (outs + SPIRV_Bool_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaLogicalLeftShiftOp : SPIRV_TosaOp<"LogicalLeftShift", 21, [Pure]> { + let summary = "LogicalLeftShift - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_logical_left_shift + }]; + + + let arguments = (ins + SPIRV_TosaInteger_TensorArmUpTo6D: $input1, + SPIRV_TosaInteger_TensorArmUpTo6D: $input2 + ); + + + let results = (outs + SPIRV_TosaInteger_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaLogicalRightShiftOp : SPIRV_TosaOp<"LogicalRightShift", 22, [Pure]> { + let summary = "LogicalRightShift - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_logical_right_shift + }]; + + + let arguments = (ins + SPIRV_TosaInteger_TensorArmUpTo6D: $input1, + SPIRV_TosaInteger_TensorArmUpTo6D: $input2 + ); + + + let results = (outs + SPIRV_TosaInteger_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaLogicalOrOp : SPIRV_TosaOp<"LogicalOr", 23, [Pure]> { + let summary = "LogicalOr - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_logical_or + }]; + + + let arguments = (ins + SPIRV_Bool_TensorArmUpTo6D: $input1, + SPIRV_Bool_TensorArmUpTo6D: $input2 + ); + + + let results = (outs + SPIRV_Bool_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaLogicalXorOp : SPIRV_TosaOp<"LogicalXor", 24, [Pure]> { + let summary = "LogicalXor - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_logical_xor + }]; + + + let arguments = (ins + SPIRV_Bool_TensorArmUpTo6D: $input1, + SPIRV_Bool_TensorArmUpTo6D: $input2 + ); + + + let results = (outs + SPIRV_Bool_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaMaximumOp : SPIRV_TosaOp<"Maximum", 25, [Pure]> { + let summary = "Maximum - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_maximum + }]; + + + let arguments = (ins + SPIRV_Int32: $nan_mode, + SPIRV_TosaNumerical_TensorArmUpTo6D: $input1, + SPIRV_TosaNumerical_TensorArmUpTo6D: $input2 + ); + + + let results = (outs + SPIRV_TosaNumerical_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaMinimumOp : SPIRV_TosaOp<"Minimum", 26, [Pure]> { + let summary = "Minimum - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_minimum + }]; + + + let arguments = (ins + SPIRV_Int32: $nan_mode, + SPIRV_TosaNumerical_TensorArmUpTo6D: $input1, + SPIRV_TosaNumerical_TensorArmUpTo6D: $input2 + ); + + + let results = (outs + SPIRV_TosaNumerical_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaMulOp : SPIRV_TosaOp<"Mul", 27, [Pure]> { + let summary = "Mul - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_mul + }]; + + + let arguments = (ins + SPIRV_TosaNumerical_TensorArmUpTo6D: $input1, + SPIRV_TosaNumerical_TensorArmUpTo6D: $input2, + SPIRV_Int8_1DTensorArmOfLength1: $shift + ); + + + let results = (outs + SPIRV_TosaNumerical_TensorArmUpTo6D: $output + ); + + let hasVerifier = 1; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaPowOp : SPIRV_TosaOp<"Pow", 28, [Pure]> { + let summary = "Pow - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_pow + }]; + + + let arguments = (ins + SPIRV_TosaFloat_TensorArmUpTo6D: $input1, + SPIRV_TosaFloat_TensorArmUpTo6D: $input2 + ); + + + let results = (outs + SPIRV_TosaFloat_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaSubOp : SPIRV_TosaOp<"Sub", 29, [Pure]> { + let summary = "Sub - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_sub + }]; + + + let arguments = (ins + SPIRV_TosaNumerical_TensorArmUpTo6D: $input1, + SPIRV_TosaNumerical_TensorArmUpTo6D: $input2 + ); + + + let results = (outs + SPIRV_TosaNumerical_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaTableOp : SPIRV_TosaOp<"Table", 30, [Pure]> { + let summary = "Table - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_table + }]; + + + let arguments = (ins + SPIRV_TosaInteger_TensorArmUpTo6D: $input1, + SPIRV_TosaInteger_TensorArm1D: $table + ); + + + let results = (outs + SPIRV_TosaInteger_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaAbsOp : SPIRV_TosaOp<"Abs", 31, [Pure]> { + let summary = "Abs - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_abs + }]; + + + let arguments = (ins + SPIRV_TosaNumerical_TensorArmUpTo6D: $input1 + ); + + + let results = (outs + SPIRV_TosaNumerical_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaBitwiseNotOp : SPIRV_TosaOp<"BitwiseNot", 32, [Pure]> { + let summary = "BitwiseNot - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_bitwise_not + }]; + + + let arguments = (ins + SPIRV_TosaInteger_TensorArmUpTo6D: $input1 + ); + + + let results = (outs + SPIRV_TosaInteger_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaCeilOp : SPIRV_TosaOp<"Ceil", 33, [Pure]> { + let summary = "Ceil - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_ceil + }]; + + + let arguments = (ins + SPIRV_TosaFloat_TensorArmUpTo6D: $input1 + ); + + + let results = (outs + SPIRV_TosaFloat_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaClzOp : SPIRV_TosaOp<"Clz", 34, [Pure]> { + let summary = "Clz - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_clz + }]; + + + let arguments = (ins + SPIRV_TosaInteger_TensorArmUpTo6D: $input1 + ); + + + let results = (outs + SPIRV_TosaInteger_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaCosOp : SPIRV_TosaOp<"Cos", 35, [Pure]> { + let summary = "Cos - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_cos + }]; + + + let arguments = (ins + SPIRV_TosaFloat_TensorArmUpTo6D: $input1 + ); + + + let results = (outs + SPIRV_TosaFloat_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaExpOp : SPIRV_TosaOp<"Exp", 36, [Pure]> { + let summary = "Exp - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_exp + }]; + + + let arguments = (ins + SPIRV_TosaFloat_TensorArmUpTo6D: $input1 + ); + + + let results = (outs + SPIRV_TosaFloat_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaFloorOp : SPIRV_TosaOp<"Floor", 37, [Pure]> { + let summary = "Floor - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_floor + }]; + + + let arguments = (ins + SPIRV_TosaFloat_TensorArmUpTo6D: $input1 + ); + + + let results = (outs + SPIRV_TosaFloat_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaLogOp : SPIRV_TosaOp<"Log", 38, [Pure]> { + let summary = "Log - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_log + }]; + + + let arguments = (ins + SPIRV_TosaFloat_TensorArmUpTo6D: $input1 + ); + + + let results = (outs + SPIRV_TosaFloat_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaLogicalNotOp : SPIRV_TosaOp<"LogicalNot", 39, [Pure]> { + let summary = "LogicalNot - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_logical_not + }]; + + + let arguments = (ins + SPIRV_Bool_TensorArmUpTo6D: $input1 + ); + + + let results = (outs + SPIRV_Bool_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaNegateOp : SPIRV_TosaOp<"Negate", 40, [Pure]> { + let summary = "Negate - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_negate + }]; + + + let arguments = (ins + SPIRV_TosaNumerical_TensorArmUpTo6D: $input1, + SPIRV_TosaNumerical_1DTensorArmOfLength1: $input1_zp, + SPIRV_TosaNumerical_1DTensorArmOfLength1: $output_zp + ); + + + let results = (outs + SPIRV_TosaNumerical_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaReciprocalOp : SPIRV_TosaOp<"Reciprocal", 41, [Pure]> { + let summary = "Reciprocal - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_reciprocal + }]; + + + let arguments = (ins + SPIRV_TosaFloat_TensorArmUpTo6D: $input1 + ); + + + let results = (outs + SPIRV_TosaFloat_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaRsqrtOp : SPIRV_TosaOp<"Rsqrt", 42, [Pure]> { + let summary = "Rsqrt - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_rsqrt + }]; + + + let arguments = (ins + SPIRV_TosaFloat_TensorArmUpTo6D: $input1 + ); + + + let results = (outs + SPIRV_TosaFloat_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaSinOp : SPIRV_TosaOp<"Sin", 43, [Pure]> { + let summary = "Sin - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_sin + }]; + + + let arguments = (ins + SPIRV_TosaFloat_TensorArmUpTo6D: $input1 + ); + + + let results = (outs + SPIRV_TosaFloat_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaSelectOp : SPIRV_TosaOp<"Select", 44, [Pure]> { + let summary = "Select - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_select + }]; + + + let arguments = (ins + SPIRV_Bool_TensorArmUpTo6D: $input1, + SPIRV_TosaAny_TensorArmUpTo6D: $input2, + SPIRV_TosaAny_TensorArmUpTo6D: $input3 + ); + + + let results = (outs + SPIRV_TosaAny_TensorArmUpTo6D: $output + ); + + let hasVerifier = 1; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaEqualOp : SPIRV_TosaOp<"Equal", 45, [Pure]> { + let summary = "Equal - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_equal + }]; + + + let arguments = (ins + SPIRV_TosaNumerical_TensorArmUpTo6D: $input1, + SPIRV_TosaNumerical_TensorArmUpTo6D: $input2 + ); + + + let results = (outs + SPIRV_Bool_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaGreaterOp : SPIRV_TosaOp<"Greater", 46, [Pure]> { + let summary = "Greater - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_greater + }]; + + + let arguments = (ins + SPIRV_TosaNumerical_TensorArmUpTo6D: $input1, + SPIRV_TosaNumerical_TensorArmUpTo6D: $input2 + ); + + + let results = (outs + SPIRV_Bool_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaGreaterEqualOp : SPIRV_TosaOp<"GreaterEqual", 47, [Pure]> { + let summary = "GreaterEqual - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_greater_equal + }]; + + + let arguments = (ins + SPIRV_TosaNumerical_TensorArmUpTo6D: $input1, + SPIRV_TosaNumerical_TensorArmUpTo6D: $input2 + ); + + + let results = (outs + SPIRV_Bool_TensorArmUpTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaReduceAllOp : SPIRV_TosaOp<"ReduceAll", 48, [Pure]> { + let summary = "ReduceAll - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_reduce_all + }]; + + + let arguments = (ins + SPIRV_Int32: $axis, + SPIRV_Bool_TensorArm1DTo6D: $input + ); + + + let results = (outs + SPIRV_Bool_TensorArm1DTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaReduceAnyOp : SPIRV_TosaOp<"ReduceAny", 49, [Pure]> { + let summary = "ReduceAny - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_reduce_any + }]; + + + let arguments = (ins + SPIRV_Int32: $axis, + SPIRV_Bool_TensorArm1DTo6D: $input + ); + + + let results = (outs + SPIRV_Bool_TensorArm1DTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaReduceMaxOp : SPIRV_TosaOp<"ReduceMax", 50, [Pure]> { + let summary = "ReduceMax - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_reduce_max + }]; + + + let arguments = (ins + SPIRV_Int32: $axis, + SPIRV_Int32: $nan_mode, + SPIRV_TosaNumerical_TensorArm1DTo6D: $input + ); + + + let results = (outs + SPIRV_TosaNumerical_TensorArm1DTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaReduceMinOp : SPIRV_TosaOp<"ReduceMin", 51, [Pure]> { + let summary = "ReduceMin - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_reduce_min + }]; + + + let arguments = (ins + SPIRV_Int32: $axis, + SPIRV_Int32: $nan_mode, + SPIRV_TosaNumerical_TensorArm1DTo6D: $input + ); + + + let results = (outs + SPIRV_TosaNumerical_TensorArm1DTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaReduceProductOp : SPIRV_TosaOp<"ReduceProduct", 52, [Pure]> { + let summary = "ReduceProduct - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_reduce_product + }]; + + + let arguments = (ins + SPIRV_Int32: $axis, + SPIRV_TosaFloat_TensorArm1DTo6D: $input + ); + + + let results = (outs + SPIRV_TosaFloat_TensorArm1DTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaReduceSumOp : SPIRV_TosaOp<"ReduceSum", 53, [Pure]> { + let summary = "ReduceSum - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_reduce_sum + }]; + + + let arguments = (ins + SPIRV_Int32: $axis, + SPIRV_TosaNumerical_TensorArm1DTo6D: $input + ); + + + let results = (outs + SPIRV_TosaNumerical_TensorArm1DTo6D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaConcatOp : SPIRV_TosaOp<"Concat", 54, [Pure]> { + let summary = "Concat - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_concat + }]; + + + let arguments = (ins + SPIRV_Int32: $axis, + Variadic: $input1 + ); + + + let results = (outs + SPIRV_TosaAny_TensorArm1DTo6D: $output + ); + + let hasVerifier = 1; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaPadOp : SPIRV_TosaOp<"Pad", 55, [Pure]> { + let summary = "Pad - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_pad + }]; + + + let arguments = (ins + SPIRV_TosaAny_TensorArm1DTo6D: $input1, + SPIRV_Int32_1DTensorArmOfEvenLength2To12: $padding, + SPIRV_TosaAny_1DTensorArmOfLength1: $pad_const + ); + + + let results = (outs + SPIRV_TosaAny_TensorArm1DTo6D: $output + ); + + let hasVerifier = 1; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaReshapeOp : SPIRV_TosaOp<"Reshape", 56, [Pure]> { + let summary = "Reshape - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_reshape + }]; + + + let arguments = (ins + SPIRV_TosaAny_TensorArmUpTo6D: $input1, + SPIRV_Int32_1DTensorArmOfLength1To6: $shape + ); + + + let results = (outs + SPIRV_TosaAny_TensorArmUpTo6D: $output + ); + + let hasVerifier = 1; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaReverseOp : SPIRV_TosaOp<"Reverse", 57, [Pure]> { + let summary = "Reverse - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_reverse + }]; + + + let arguments = (ins + SPIRV_Int32: $axis, + SPIRV_TosaAny_TensorArm1DTo6D: $input1 + ); + + + let results = (outs + SPIRV_TosaAny_TensorArm1DTo6D: $output + ); + + let hasVerifier = 1; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaSliceOp : SPIRV_TosaOp<"Slice", 58, [Pure]> { + let summary = "Slice - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_slice + }]; + + + let arguments = (ins + SPIRV_TosaAny_TensorArm1DTo6D: $input1, + SPIRV_Int32_1DTensorArmOfLength1To6: $start, + SPIRV_Int32_1DTensorArmOfLength1To6: $size + ); + + + let results = (outs + SPIRV_TosaAny_TensorArm1DTo6D: $output + ); + + let hasVerifier = 1; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaTileOp : SPIRV_TosaOp<"Tile", 59, [Pure]> { + let summary = "Tile - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_tile + }]; + + + let arguments = (ins + SPIRV_TosaAny_TensorArm1DTo6D: $input1, + SPIRV_Int32_1DTensorArmOfLength1To6: $multiples + ); + + + let results = (outs + SPIRV_TosaAny_TensorArm1DTo6D: $output + ); + + let hasVerifier = 1; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaTransposeOp : SPIRV_TosaOp<"Transpose", 60, [Pure]> { + let summary = "Transpose - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_transpose + }]; + + + let arguments = (ins + SPIRV_Int32_1DTensorArmOfLength1To6: $perms, + SPIRV_TosaAny_TensorArm1DTo6D: $input1 + ); + + + let results = (outs + SPIRV_TosaAny_TensorArm1DTo6D: $output + ); + + let hasVerifier = 1; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaGatherOp : SPIRV_TosaOp<"Gather", 61, [Pure]> { + let summary = "Gather - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_gather + }]; + + + let arguments = (ins + SPIRV_TosaNumerical_TensorArm3D: $values, + SPIRV_Int32_TensorArm2D: $indices + ); + + + let results = (outs + SPIRV_TosaNumerical_TensorArm3D: $output + ); + + let hasVerifier = 1; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaScatterOp : SPIRV_TosaOp<"Scatter", 62, [Pure]> { + let summary = "Scatter - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_scatter + }]; + + + let arguments = (ins + SPIRV_TosaNumerical_TensorArm3D: $values_in, + SPIRV_Int32_TensorArm2D: $indices, + SPIRV_TosaNumerical_TensorArm3D: $input + ); + + + let results = (outs + SPIRV_TosaNumerical_TensorArm3D: $values_out + ); + + let hasVerifier = 1; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaResizeOp : SPIRV_TosaOp<"Resize", 63, [Pure]> { + let summary = "Resize - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_resize + }]; + + + let arguments = (ins + SPIRV_Int32: $mode, + SPIRV_TosaNumerical_TensorArm4D: $input, + SPIRV_Int32_1DTensorArmOfLength4: $scale, + SPIRV_Int32_1DTensorArmOfLength2: $offset, + SPIRV_Int32_1DTensorArmOfLength2: $border + ); + + + let results = (outs + SPIRV_TosaNumerical_TensorArm4D: $output + ); + + let hasVerifier = 0; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaCastOp : SPIRV_TosaOp<"Cast", 64, [Pure]> { + let summary = "Cast - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_cast + }]; + + + let arguments = (ins + SPIRV_TosaAny_TensorArmUpTo6D: $input + ); + + + let results = (outs + SPIRV_TosaAny_TensorArmUpTo6D: $output + ); + + let hasVerifier = 1; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +def SPIRV_TosaRescaleOp : SPIRV_TosaOp<"Rescale", 65, [Pure]> { + let summary = "Rescale - TOSA extended instruction set 001000.1"; + + let description = [{ + https://github.khronos.org/SPIRV-Registry/extended/TOSA.001000.1.html#_rescale + }]; + + + let arguments = (ins + SPIRV_Bool: $scale32, + SPIRV_Int32: $rounding_mode, + SPIRV_Bool: $per_channel, + SPIRV_Bool: $input_unsigned, + SPIRV_Bool: $output_unsigned, + SPIRV_TosaInteger_TensorArmUpTo6D: $input, + SPIRV_Int16OrInt32_TensorArm1D: $multiplier, + SPIRV_Int8_TensorArm1D: $shift, + SPIRV_TosaInteger_1DTensorArmOfLength1: $input_zp, + SPIRV_TosaInteger_1DTensorArmOfLength1: $output_zp + ); + + + let results = (outs + SPIRV_TosaInteger_TensorArmUpTo6D: $output + ); + + let hasVerifier = 1; + + let assemblyFormat = [{ + operands attr-dict `:` `(` type(operands) `)` `->` type(results) + }]; +} + + +#endif // MLIR_DIALECT_SPIRV_IR_TOSA_OPS diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVTosaTypes.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVTosaTypes.td new file mode 100644 index 0000000000000..c9e23b60470ba --- /dev/null +++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVTosaTypes.td @@ -0,0 +1,97 @@ +//===- SPIRVTosaTypes.td - Tosa Types insts spec file ----*- tablegen -*-=// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This specifies Tosa types used by the Graph Extension and Tosa Ops. +// +//===----------------------------------------------------------------------===// + +#ifndef MLIR_DIALECT_SPIRV_IR_TOSA_TYPES +#define MLIR_DIALECT_SPIRV_IR_TOSA_TYPES + +include "mlir/Dialect/SPIRV/IR/SPIRVBase.td" + +def SPIRV_TosaInteger : AnyIntOfWidths<[8, 16, 32, 64]>; +def SPIRV_TosaFloat : AnyTypeOf<[BF16, SPIRV_Float16or32]>; +def SPIRV_TosaNumerical : AnyTypeOf<[SPIRV_TosaInteger, SPIRV_TosaFloat]>; +def SPIRV_TosaAny : AnyTypeOf<[SPIRV_TosaNumerical, SPIRV_Bool]>; + +// TensorARM type + +class RankedTensorArmOf allowedTypes, list preds = [], + string summary = "ranked tensorArm"> + : ShapedContainerType< + allowedTypes, And, + summary, "::mlir::spirv::TensorArmType">; + +class TensorArmRankOf allowedTypes, list ranks> + : RankedTensorArmOf], + !interleave(!foreach(rank, ranks, rank # "D"), "/") # " tensorArm">; + +def SPIRV_Int8_TensorArm1D : TensorArmRankOf<[SPIRV_Int8], [1]>; +def SPIRV_Int16OrInt32_TensorArm1D : TensorArmRankOf<[SPIRV_Int16, SPIRV_Int32], [1]>; +def SPIRV_Int32_TensorArm2D : TensorArmRankOf<[SPIRV_Int32], [2]>; +def SPIRV_TosaFloat_TensorArm3D: TensorArmRankOf<[SPIRV_TosaFloat], [3]>; +def SPIRV_TosaInteger_TensorArm1D : TensorArmRankOf<[SPIRV_TosaInteger], [1]>; +def SPIRV_TosaNumerical_TensorArm1D : TensorArmRankOf<[SPIRV_TosaNumerical], [1]>; +def SPIRV_TosaNumerical_TensorArm3D : TensorArmRankOf<[SPIRV_TosaNumerical], [3]>; +def SPIRV_TosaNumerical_TensorArm4D : TensorArmRankOf<[SPIRV_TosaNumerical], [4]>; +def SPIRV_TosaNumerical_TensorArm5D : TensorArmRankOf<[SPIRV_TosaNumerical], [5]>; + +def SPIRV_TosaAny_TensorArmUpTo6D : TensorArmRankOf<[SPIRV_TosaAny], [0, 1, 2, 3, 4, 5, 6]>; +def SPIRV_TosaAny_TensorArm1DTo6D : TensorArmRankOf<[SPIRV_TosaAny], [1, 2, 3, 4, 5, 6]>; +def SPIRV_TosaNumerical_TensorArmUpTo6D : TensorArmRankOf<[SPIRV_TosaNumerical], [0, 1, 2, 3, 4, 5, 6]>; +def SPIRV_TosaNumerical_TensorArm1DTo6D : TensorArmRankOf<[SPIRV_TosaNumerical], [1, 2, 3, 4, 5, 6]>; +def SPIRV_TosaInteger_TensorArmUpTo5D : TensorArmRankOf<[SPIRV_TosaInteger], [0, 1, 2, 3, 4, 5]>; +def SPIRV_TosaInteger_TensorArmUpTo6D : TensorArmRankOf<[SPIRV_TosaInteger], [0, 1, 2, 3, 4, 5, 6]>; +def SPIRV_TosaFloat_TensorArmUpTo6D : TensorArmRankOf<[SPIRV_TosaFloat], [0, 1, 2, 3, 4, 5, 6]>; +def SPIRV_TosaFloat_TensorArm1DTo6D : TensorArmRankOf<[SPIRV_TosaFloat], [1, 2, 3, 4, 5, 6]>; +def SPIRV_Bool_TensorArmUpTo6D : TensorArmRankOf<[SPIRV_Bool], [0, 1, 2, 3, 4, 5, 6]>; +def SPIRV_Bool_TensorArm1DTo6D : TensorArmRankOf<[SPIRV_Bool], [1, 2, 3, 4, 5, 6]>; + +class Is1DTensorArmOfLength allowedLengths> : + And<[HasAnyRankOfPred<[1]>, + Or($_self).getShape()[0] == }] + # allowedlength>)>]>; + +class SPIRV_1DTensorArmOfLengthAndType allowedLengths, list allowedTypes> : + ContainerType, Is1DTensorArmOfLength, + "::llvm::cast<::mlir::spirv::TensorArmType>($_self).getElementType()", + "rank 1 tensorArm of length " # !interleave(allowedLengths, "/"), + "::mlir::spirv::TensorArmType">; + +def SPIRV_Int32_1DTensorArmOfLength2 : SPIRV_1DTensorArmOfLengthAndType<[2], [SPIRV_Int32]>; +def SPIRV_Int32_1DTensorArmOfLength3 : SPIRV_1DTensorArmOfLengthAndType<[3], [SPIRV_Int32]>; +def SPIRV_Int32_1DTensorArmOfLength4 : SPIRV_1DTensorArmOfLengthAndType<[4], [SPIRV_Int32]>; +def SPIRV_Int32_1DTensorArmOfLength6 : SPIRV_1DTensorArmOfLengthAndType<[6], [SPIRV_Int32]>; + +def SPIRV_Int32_1DTensorArmOfLength1To6 : SPIRV_1DTensorArmOfLengthAndType<[1,2,3,4,5,6], [SPIRV_Int32]>; +def SPIRV_Int32_1DTensorArmOfEvenLength2To12 : SPIRV_1DTensorArmOfLengthAndType<[2,4,6,8,10,12], [SPIRV_Int32]>; + +def SPIRV_Int8_1DTensorArmOfLength1 : SPIRV_1DTensorArmOfLengthAndType<[1], [SPIRV_Int8]>; +def SPIRV_TosaInteger_1DTensorArmOfLength1 : SPIRV_1DTensorArmOfLengthAndType<[1], [SPIRV_TosaInteger]>; +def SPIRV_TosaNumerical_1DTensorArmOfLength1 : SPIRV_1DTensorArmOfLengthAndType<[1], [SPIRV_TosaNumerical]>; +def SPIRV_TosaAny_1DTensorArmOfLength1 : SPIRV_1DTensorArmOfLengthAndType<[1], [SPIRV_TosaAny]>; + +// Struct type + +class IsStructOfLengthPred : + And<[SPIRV_IsStructType, + CPred<[{::llvm::cast<::mlir::spirv::StructType>($_self).getNumElements() + == }] + # allowedLength>]>; + +class IsStructOfLengthAndType allowedTypes> + : MixedContainerType, IsStructOfLengthPred, + "::llvm::cast<::mlir::spirv::StructType>($_self).getElementTypes()", + "Struct">; + +def SPIRV_Struct_2_TosaFloat_TensorArm3D : IsStructOfLengthAndType<2, [SPIRV_TosaFloat_TensorArm3D]>; + +#endif // MLIR_DIALECT_SPIRV_IR_TOSA_TYPES diff --git a/mlir/lib/Dialect/SPIRV/IR/CMakeLists.txt b/mlir/lib/Dialect/SPIRV/IR/CMakeLists.txt index 60d705d940cfc..ec3ab4045afa9 100644 --- a/mlir/lib/Dialect/SPIRV/IR/CMakeLists.txt +++ b/mlir/lib/Dialect/SPIRV/IR/CMakeLists.txt @@ -24,6 +24,7 @@ add_mlir_dialect_library(MLIRSPIRVDialect SPIRVParsingUtils.cpp SPIRVTypes.cpp TargetAndABI.cpp + TosaOps.cpp ADDITIONAL_HEADER_DIRS ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV diff --git a/mlir/lib/Dialect/SPIRV/IR/TosaOps.cpp b/mlir/lib/Dialect/SPIRV/IR/TosaOps.cpp new file mode 100644 index 0000000000000..f53fbd3938731 --- /dev/null +++ b/mlir/lib/Dialect/SPIRV/IR/TosaOps.cpp @@ -0,0 +1,1133 @@ +//===- TosaOps.cpp - MLIR SPIR-V operations -------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines the Tosa operations in the SPIR-V dialect. +// +//===----------------------------------------------------------------------===// + +#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h" + +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/TypeUtilities.h" + +using namespace mlir; + +//===----------------------------------------------------------------------===// +// TOSA Operator Verifiers. +//===----------------------------------------------------------------------===// + +// Get value attr from spirv::ConstantOp or +// spirv::EXTConstantCompositeReplicateOp +template +static LogicalResult getConstAttr(Value value, TAttr &valAttr) { + if (auto constOp = value.template getDefiningOp()) { + valAttr = dyn_cast(constOp.getValue()); + } else if (auto constCompositeReplicateOp = + value.template getDefiningOp< + spirv::EXTConstantCompositeReplicateOp>()) { + auto splatAttr = constCompositeReplicateOp.getValue(); + auto denseValAttr = SplatElementsAttr::get( + cast(constCompositeReplicateOp.getType()), splatAttr); + valAttr = dyn_cast(denseValAttr); + } + + return valAttr ? success() : failure(); +} + +template +static LogicalResult verifyConvOp(T op, TAdaptor adaptor) { + auto inputTy = cast(op.getInput().getType()); + auto weightTy = cast(op.getWeight().getType()); + auto biasTy = cast(op.getBias().getType()); + auto resultTy = cast(op.getType()); + + if constexpr (std::is_same_v) { + if (inputTy.hasRank() && inputTy.getRank() != 5) { + return op.emitOpError("input rank must be 5"); + } + + if (weightTy.hasRank() && weightTy.getRank() != 5) { + return op.emitOpError("weight rank must be 5"); + } + + if (resultTy.hasRank() && resultTy.getRank() != 5) { + return op.emitOpError("result rank must be 5"); + } + } else { + if (inputTy.getRank() != 4) { + return op.emitOpError("input rank must be 4"); + } + + if (weightTy.hasRank() && weightTy.getRank() != 4) { + return op.emitOpError("weight rank must be 4"); + } + + if (resultTy.hasRank() && resultTy.getRank() != 4) { + return op.emitOpError("result rank must be 4"); + } + } + + if (biasTy.hasRank() && biasTy.getRank() != 1) { + return op.emitOpError("bias rank must be 1"); + } + + auto inputETy = inputTy.getElementType(); + auto weightETy = weightTy.getElementType(); + auto biasETy = biasTy.getElementType(); + auto resultETy = resultTy.getElementType(); + + if (inputETy.isInteger(8) && !resultETy.isInteger(32)) { + return op.emitOpError("expect result type to be i32, got ") << resultETy; + } + + if (inputETy.isInteger(16) && !resultETy.isInteger(64)) { + return op.emitOpError("expect result type to be i64, got ") << resultETy; + } + + if (inputETy.isF16() && !resultETy.isF16()) { + return op.emitOpError("expect result type to be f16, got ") << resultETy; + } + + if (inputETy.isF32() && !resultETy.isF32()) { + return op.emitOpError("expect result type to be f32, got ") << resultETy; + } + + if (biasETy != resultETy) { + return op.emitOpError("element types of bias and result must be the same"); + } + + DenseIntOrFPElementsAttr inputZpAttr; + if (getConstAttr(adaptor.getInputZp(), inputZpAttr).failed()) { + return op.emitOpError( + "input_zp must be a tensorARM of an integer/float constant"); + } + + if (inputZpAttr.size() != 1) { + return op.emitOpError("input_zp must have a single element"); + } + + auto inputZpETy = inputZpAttr.getElementType(); + if (inputZpETy != inputETy) { + return op.emitOpError( + "element types of input_zp and input must be the same"); + } + + DenseIntOrFPElementsAttr weightZpAttr; + if (getConstAttr(adaptor.getWeightZp(), weightZpAttr).failed()) { + return op.emitOpError( + "weight_zp must be a tensorARM of an integer/float constant"); + } + + if (weightZpAttr.size() != 1) { + return op.emitOpError("weight_zp must have a single element"); + } + + auto weightZpETy = weightZpAttr.getElementType(); + if (weightZpETy != weightETy) { + return op.emitOpError( + "element types of weight_zp and weight must be the same"); + } + + if (isa(inputZpETy)) { + if ((inputZpETy.getIntOrFloatBitWidth() != 8) && + !inputZpAttr.getValues()[0].isZero()) { + return op.emitOpError( + "input_zp element value must be zero for non-int8 types."); + } + } else { + if (!inputZpAttr.getValues()[0].isZero()) { + return op.emitOpError( + "input_zp element value must be zero for non-int8 types."); + } + } + + if (isa(weightZpETy)) { + if ((weightZpETy.getIntOrFloatBitWidth() != 8) && + !weightZpAttr.getValues()[0].isZero()) { + return op.emitOpError( + "weight_zp element value must be zero for non-int8 types."); + } + } else { + if (!weightZpAttr.getValues()[0].isZero()) { + return op.emitOpError( + "weight_zp element value must be zero for non-int8 types."); + } + } + + BoolAttr localBoundAttr; + if ((getConstAttr(adaptor.getLocalBound(), localBoundAttr).failed())) { + return op.emitOpError("local bound must be a constant boolean"); + } + + return success(); +} + +template +static LogicalResult verifyConvOpModes(T op) { + IntegerAttr accTypeAttr; + if (getConstAttr(op.getAccType(), accTypeAttr).failed()) { + return op.emitOpError("accumulator type must be a constant integer"); + } + + int accType = accTypeAttr.getInt(); + if (accType != 1 && accType != 2 && accType != 3 && accType != 4) { + return op.emitOpError("accumulator type can only have values 1/2/3/4 " + "corresponding to i32/f16/f32/i48"); + } + + auto inputTy = cast(op.getInput().getType()); + auto inputETy = inputTy.getElementType(); + + if (inputETy.isInteger(8) && accType != 1) { + return op.emitOpError("accumulator type for i8 tensorARM is not i32"); + } + + if (inputETy.isInteger(16) && accType != 4) { + return op.emitOpError("accumulator type for i16 tensorARM is not i48"); + } + + if (inputETy.isF16() && !(accType == 2 || accType == 3)) { + return op.emitOpError( + "accumulator type for f16 tensorARM is not f16 or f32"); + } + + if (inputETy.isBF16() && accType != 3) { + return op.emitOpError("accumulator type for bf16 tensorARM is not f32"); + } + + if (inputETy.isF32() && accType != 3) { + return op.emitOpError("accumulator type for f32 tensorARM is not f32"); + } + + return success(); +} + +// Verify that inType and outType have same element types +template +static LogicalResult verifySameElementTypes(TOp op, Type inType, Type outType) { + auto inputType = dyn_cast(inType); + auto outputType = dyn_cast(outType); + + if (!inputType) { + op.emitOpError("expect shaped tensorARM for input, got ") << inType; + return failure(); + } + if (!outputType) { + op.emitOpError("expect shaped tensorARM for output, got ") << outType; + return failure(); + } + auto inputElementType = inputType.getElementType(); + auto outputElementType = outputType.getElementType(); + + if (inputElementType != outputElementType) { + op.emitOpError("expect input and output to have same element type, got ") + << inputElementType << " and " << outputElementType; + return failure(); + } + return success(); +} + +//===----------------------------------------------------------------------===// +// spirv.TosaArgmaxOp +//===----------------------------------------------------------------------===// + +LogicalResult spirv::TosaArgMaxOp::verify() { + auto inputTy = cast(getInput().getType()); + auto resultTy = cast(getType()); + + if (inputTy.hasRank() && resultTy.hasRank() && + resultTy.getRank() != + (inputTy.getRank() > 1 ? inputTy.getRank() - 1 : 1)) { + return emitOpError("result rank must be max of 1 and (input rank - 1)"); + } + + auto resultETy = resultTy.getElementType(); + if (!resultETy.isIntOrIndex()) { + return emitOpError("result is not of integer type"); + } + + IntegerAttr axisAttr; + if (getConstAttr(getAxis(), axisAttr).failed()) { + return emitOpError("axis type must be a constant integer"); + } + + const int axis = axisAttr.getInt(); + if (inputTy.hasRank() && ((axis < 0) || axis >= inputTy.getRank())) { + return emitOpError("specified axis is outside the rank of input"); + } + + IntegerAttr nanModeAttr; + if (getConstAttr(getNanMode(), nanModeAttr).failed()) { + return emitOpError("nan_mode type must be a constant integer"); + } + + int nanMode = nanModeAttr.getInt(); + if (nanMode != 1 && nanMode != 2) { + return emitOpError("nan_mode can only have values 1 and 2 corresponding to " + "PROPAGATE/IGNORE"); + } + + return success(); +} + +//===----------------------------------------------------------------------===// +// spirv.TosaAvgPool2DOp +//===----------------------------------------------------------------------===// + +LogicalResult spirv::TosaAvgPool2DOp::verify() { + auto inputTy = cast(getInput().getType()); + if (inputTy.hasRank() && inputTy.getRank() != 4) { + return emitOpError("input rank must be 4"); + } + + auto resultTy = cast(getType()); + if (resultTy.hasRank() && resultTy.getRank() != 4) { + return emitOpError("result rank must be 4"); + } + + IntegerAttr accTypeAttr; + if (getConstAttr(getAccType(), accTypeAttr).failed()) { + return emitOpError("accumulator type must be a constant integer"); + } + + int accType = accTypeAttr.getInt(); + if (accType != 1 && accType != 2 && accType != 3) { + return emitOpError("accumulator type can only have values 1/2/3 " + "corresponding to i32/f16/f32"); + } + + auto inputETy = inputTy.getElementType(); + auto resultETy = resultTy.getElementType(); + + if (isa(inputETy) && accType != 1) { + return emitOpError("accumulator type for integer tensorARM is not i32"); + } + + if (inputETy.isF16() && !(accType == 2 || accType == 3)) { + return emitOpError("accumulator type for f16 tensorARM is not f16/f32"); + } + + if (inputETy.isF32() && accType != 3) { + return emitOpError("accumulator type for f32 tensorARM is not f32"); + } + + if (inputETy != resultETy) { + return emitOpError("input and output element types must be the same"); + } + + return success(); +} + +//===----------------------------------------------------------------------===// +// spirv.TosaConv2DOp +//===----------------------------------------------------------------------===// + +LogicalResult spirv::TosaConv2DOp::verify() { + if (verifyConvOp(*this, TosaConv2DOp::Adaptor(*this)).failed() || + verifyConvOpModes(*this).failed()) + return failure(); + return success(); +} + +//===----------------------------------------------------------------------===// +// spirv.TosaConv3DOp +//===----------------------------------------------------------------------===// + +LogicalResult spirv::TosaConv3DOp::verify() { + if (verifyConvOp(*this, TosaConv3DOp::Adaptor(*this)).failed() || + verifyConvOpModes(*this).failed()) + return failure(); + return success(); +} + +//===----------------------------------------------------------------------===// +// SPIRV Tosa DepthwiseConv2D Ops: +//===----------------------------------------------------------------------===// + +LogicalResult spirv::TosaDepthwiseConv2DOp::verify() { + if (verifyConvOp(*this, TosaDepthwiseConv2DOp::Adaptor(*this)).failed() || + verifyConvOpModes(*this).failed()) + return failure(); + return success(); +} + +//===----------------------------------------------------------------------===// +// spirv.TosaFFT2DOp +//===----------------------------------------------------------------------===// + +LogicalResult spirv::TosaFFT2DOp::verify() { + auto inputRealTy = cast(getInputReal().getType()); + auto inputImagTy = cast(getInputImag().getType()); + auto resultTy = cast(getType()); + auto resultRealTy = cast(resultTy.getElementType(0)); + auto resultImagTy = cast(resultTy.getElementType(1)); + + if (inputRealTy.hasRank() && inputRealTy.getRank() != 3) { + return emitOpError("real input rank must be 3"); + } + + if (inputImagTy.hasRank() && inputImagTy.getRank() != 3) { + return emitOpError("imaginary input rank must be 3"); + } + + if (resultRealTy.hasRank() && resultRealTy.getRank() != 3) { + return emitOpError("real result rank must be 3"); + } + + if (resultImagTy.hasRank() && resultImagTy.getRank() != 3) { + return emitOpError("imaginary result rank must be 3"); + } + + if (inputRealTy != inputImagTy || inputRealTy != resultRealTy || + inputImagTy != resultImagTy) { + return emitOpError("real input type, imaginary input type, and types of " + "real and imaginary parts of result must be the same"); + } + + BoolAttr inverseAttr; + if ((getConstAttr(getInverse(), inverseAttr).failed())) { + return emitOpError("inverse must be a constant boolean"); + } + + BoolAttr localBoundAttr; + if ((getConstAttr(getLocalBound(), localBoundAttr).failed())) { + return emitOpError("local bound must be a constant boolean"); + } + + return success(); +} + +//===----------------------------------------------------------------------===// +// spirv.TosaMatMulOp +//===----------------------------------------------------------------------===// + +LogicalResult spirv::TosaMatMulOp::verify() { + auto aTy = cast(getA().getType()); + auto bTy = cast(getB().getType()); + auto resultTy = cast(getType()); + + if (!aTy || !bTy) { + return emitOpError("expected shaped tensors for inputs, got ") + << getA().getType() << " and " << getB().getType(); + } + + if (aTy.hasRank() && aTy.getRank() != 3) { + return emitOpError("A rank must be 3"); + } + + if (bTy.hasRank() && bTy.getRank() != 3) { + return emitOpError("B rank must be 3"); + } + + if (resultTy.hasRank() && resultTy.getRank() != 3) { + return emitOpError("result rank must be 3"); + } + + auto aETy = aTy.getElementType(); + auto bETy = bTy.getElementType(); + auto resultETy = resultTy.getElementType(); + + if (aETy != bETy) { + return emitOpError("expect same element type for inputs a and b, got ") + << aETy << " and " << bETy; + } + + if (aETy.isInteger(8) && !resultETy.isInteger(32)) { + return emitOpError("expect result element type to be i32, got ") + << resultETy; + } + + if (aETy.isInteger(16) && !resultETy.isInteger(64)) { + return emitOpError("expect result element type to be i64, got ") + << resultETy; + } + + if (aETy.isF16() && !(resultETy.isF16() || resultETy.isF32())) { + return emitOpError("expect result element type to be f16 or f32, got ") + << resultETy; + } + + if (aETy.isF32() && !resultETy.isF32()) { + return emitOpError("expect result element type to be f32, got ") + << resultETy; + } + + DenseIntOrFPElementsAttr aZpAttr; + if (getConstAttr(getAZp(), aZpAttr).failed()) { + return emitOpError("a_zp must be a tensorARM of an integer/float constant"); + } + + if (aZpAttr.size() != 1) { + return emitOpError("a_zp must have a single element"); + } + + DenseIntOrFPElementsAttr bZpAttr; + if (getConstAttr(getBZp(), bZpAttr).failed()) { + return emitOpError("b_zp must be a tensorARM of an integer/float constant"); + } + + if (bZpAttr.size() != 1) { + return emitOpError("b_zp must have a single element"); + } + + if (isa(aETy)) { + if ((aETy.getIntOrFloatBitWidth() != 8) && + (!aZpAttr.getValues()[0].isZero() || + !bZpAttr.getValues()[0].isZero())) { + return emitOpError("a_zp and b_zp must be zero for non-int8 types."); + } + } else { + if (!aZpAttr.getValues()[0].isZero() || + !bZpAttr.getValues()[0].isZero()) { + return emitOpError("a_zp and b_zp must be zero for non-int8 types."); + } + } + + return success(); +} + +//===----------------------------------------------------------------------===// +// spirv.TosaMaxPool2DOp +//===----------------------------------------------------------------------===// + +LogicalResult spirv::TosaMaxPool2DOp::verify() { + auto inputTy = cast(getInput().getType()); + auto resultTy = cast(getType()); + + if (inputTy.hasRank() && inputTy.getRank() != 4) { + return emitOpError("input rank must be 4"); + } + + if (resultTy.hasRank() && resultTy.getRank() != 4) { + return emitOpError("result rank must be 4"); + } + + IntegerAttr nanModeAttr; + if (getConstAttr(getNanMode(), nanModeAttr).failed()) { + return emitOpError("nan_mode type must be a constant integer"); + } + + int nanMode = nanModeAttr.getInt(); + if (nanMode != 1 && nanMode != 2) { + return emitOpError("nan_mode can only have values 1 and 2 corresponding to " + "PROPAGATE/IGNORE"); + } + + return verifySameElementTypes(*this, getInput().getType(), + getOutput().getType()); +} + +//===----------------------------------------------------------------------===// +// spirv.TosaRFFT2DOp +//===----------------------------------------------------------------------===// + +LogicalResult spirv::TosaRFFT2DOp::verify() { + auto inputTy = cast(getInputReal().getType()); + auto resultTy = cast(getType()); + auto resultRealTy = cast(resultTy.getElementType(0)); + auto resultImagTy = cast(resultTy.getElementType(1)); + + if (inputTy.hasRank() && inputTy.getRank() != 3) { + return emitOpError("input rank must be 3"); + } + + if (resultRealTy.hasRank() && resultRealTy.getRank() != 3) { + return emitOpError("real result rank must be 3"); + } + + if (resultImagTy.hasRank() && resultImagTy.getRank() != 3) { + return emitOpError("imaginary result rank must be 3"); + } + + if (inputTy.getElementType() != resultRealTy.getElementType() || + inputTy.getElementType() != resultImagTy.getElementType()) { + return emitOpError( + "input element type and element types of real and imaginary parts of " + "result must be the same"); + } + + BoolAttr localBoundAttr; + if ((getConstAttr(getLocalBound(), localBoundAttr).failed())) { + return emitOpError("local bound must be a constant boolean"); + } + + return success(); +} + +//===----------------------------------------------------------------------===// +// SPIRV Tosa TransposeConv2D Ops: +//===----------------------------------------------------------------------===// + +LogicalResult spirv::TosaTransposeConv2DOp::verify() { + if (verifyConvOp(*this, TosaTransposeConv2DOp::Adaptor(*this)).failed() || + verifyConvOpModes(*this).failed()) + return failure(); + return success(); +} + +//===----------------------------------------------------------------------===// +// spirv.TosaMulOp +//===----------------------------------------------------------------------===// +LogicalResult spirv::TosaMulOp::verify() { + auto resElemType = getElementTypeOrSelf(getOutput()); + + // Verify if the element type amoung operands and result match tosa + // specification. + if (auto resIntType = dyn_cast(resElemType)) { + IntegerType lhsIntType = + cast(getElementTypeOrSelf(getInput1())); + IntegerType rhsIntType = + cast(getElementTypeOrSelf(getInput2())); + if (lhsIntType != rhsIntType) + return emitOpError( + "requires the same element type for all input operands"); + + // Though the spec requires the element type of result to be i32, a more + // relaxed way is provided at dialect level for easier cooperating with + // other dialects. + if (lhsIntType.getWidth() > resIntType.getWidth()) + return emitOpError("invalid data type size for operands or result"); + } else { + // For other supported type, the spec requires requires the same element + // type for all operands (excludes `shift` operand) and results. + for (int i = 0; i < 2; ++i) { + if (getElementTypeOrSelf(getOperand(i)) != resElemType) + return emitOpError( + "requires the same element type for all operands and results"); + } + } + + auto compareRank = [](const ShapedType type, const ShapedType against) { + return type.hasRank() && against.hasRank() && + type.getRank() == against.getRank(); + }; + ShapedType opType = cast(getType()); + for (int i = 0; i < 2; ++i) { + if (!compareRank(cast(getOperand(i).getType()), opType)) + return emitOpError("result type has different rank than operands"); + } + return success(); +} + +//===----------------------------------------------------------------------===// +// spirv.TosaCastOp +//===----------------------------------------------------------------------===// +LogicalResult spirv::TosaCastOp::verify() { + auto inputETy = cast(getInput().getType()).getElementType(); + auto outputETy = cast(getType()).getElementType(); + + // input element type: bool + if (inputETy.isInteger(1)) { + if (outputETy.isInteger(8) || outputETy.isInteger(16) || + outputETy.isInteger(32)) { + return success(); + } + } + // input element type: int8 + if (inputETy.isInteger(8)) { + if (outputETy.isInteger(1) || outputETy.isInteger(16) || + outputETy.isInteger(32) || outputETy.isF16() || outputETy.isBF16() || + outputETy.isF32()) { + return success(); + } + } + // input element type: int16 + if (inputETy.isInteger(16)) { + if (outputETy.isInteger(1) || outputETy.isInteger(8) || + outputETy.isInteger(32) || outputETy.isF16() || outputETy.isBF16() || + outputETy.isF32()) { + return success(); + } + } + // input element type: int32 + if (inputETy.isInteger(32)) { + if (outputETy.isInteger(1) || outputETy.isInteger(8) || + outputETy.isInteger(16) || outputETy.isF16() || outputETy.isBF16() || + outputETy.isF32()) { + return success(); + } + } + // input element type: bf16 or fp16 + if (inputETy.isBF16() || inputETy.isF16()) { + if (outputETy.isInteger(8) || outputETy.isInteger(16) || + outputETy.isInteger(32) || outputETy.isF32()) { + return success(); + } + } + // input element type: fp32 + if (inputETy.isF32()) { + if (outputETy.isInteger(8) || outputETy.isInteger(16) || + outputETy.isInteger(32) || outputETy.isF16() || outputETy.isBF16()) { + return success(); + } + } + + return emitOpError("input/output element types are incompatible: ") + << inputETy << " and " << outputETy; +} + +//===----------------------------------------------------------------------===// +// spirv.TosaClampOp +//===----------------------------------------------------------------------===// +LogicalResult spirv::TosaClampOp::verify() { + auto inputETy = cast(getInput().getType()).getElementType(); + auto outputETy = cast(getOutput().getType()).getElementType(); + + if (inputETy != outputETy) + return emitOpError("input/output element types are incompatible"); + + unsigned dataTypeBitWidth = inputETy.getIntOrFloatBitWidth(); + + if (inputETy.isInteger(dataTypeBitWidth)) { + IntegerAttr minValAttr, maxValAttr; + if ((getConstAttr(getMinVal(), minValAttr).failed()) || + (getConstAttr(getMaxVal(), maxValAttr).failed()) || + (minValAttr.getType() != maxValAttr.getType()) || + (minValAttr.getType() != inputETy)) + + return emitOpError("min/max attributes types are incompatible with " + "input/output element types."); + } else { + FloatAttr minValAttr, maxValAttr; + if ((getConstAttr(getMinVal(), minValAttr).failed()) || + (getConstAttr(getMaxVal(), maxValAttr).failed()) || + (minValAttr.getType() != maxValAttr.getType()) || + (minValAttr.getType() != inputETy)) + + return emitOpError("min/max attributes types are incompatible with " + "input/output element types."); + } + return success(); +} + +//===----------------------------------------------------------------------===// +// spirv.TosaConcatOp +//===----------------------------------------------------------------------===// +LogicalResult spirv::TosaConcatOp::verify() { + auto outType = getOutput().getType(); + for (auto input : getInput1()) { + if (verifySameElementTypes(*this, input.getType(), outType).failed()) { + return failure(); + } + } + IntegerAttr axisAttr; + if (getConstAttr(getAxis(), axisAttr).failed()) { + return emitOpError("Axis must be an integer constant"); + } + return success(); +} + +//===----------------------------------------------------------------------===// +// spirv.TosaPadOp +//===----------------------------------------------------------------------===// +LogicalResult spirv::TosaPadOp::verify() { + if (verifySameElementTypes(*this, getInput1().getType(), + getOutput().getType()) + .failed()) { + return failure(); + } + + auto inputETy = cast(getInput1().getType()).getElementType(); + + DenseIntOrFPElementsAttr padConstAttr; + if ((getConstAttr(getPadConst(), padConstAttr).failed()) || + (padConstAttr.getElementType() != inputETy)) { + return emitOpError( + "PadConst element type is not same as input element type."); + } + return success(); +} + +//===----------------------------------------------------------------------===// +// spirv.TosaSliceOp +//===----------------------------------------------------------------------===// +LogicalResult spirv::TosaSliceOp::verify() { + auto inputTy = cast(getInput1().getType()); + auto outputTy = cast(getOutput().getType()); + auto startTy = cast(getStart().getType()); + auto sizeTy = cast(getSize().getType()); + + if (verifySameElementTypes(*this, inputTy, outputTy).failed()) { + return failure(); + } + + if (inputTy.hasRank() && startTy.hasRank() && + startTy.getShape()[0] != ShapedType::kDynamic && + inputTy.getRank() != startTy.getShape()[0]) { + return emitOpError("length of start is not equal to rank of input shape"); + } + + if (inputTy.hasRank() && sizeTy.hasRank() && + sizeTy.getShape()[0] != ShapedType::kDynamic && + inputTy.getRank() != sizeTy.getShape()[0]) { + return emitOpError("length of size is not equal to rank of input shape"); + } + return success(); +} + +//===----------------------------------------------------------------------===// +// spirv.TosaTileOp +//===----------------------------------------------------------------------===// +LogicalResult spirv::TosaTileOp::verify() { + auto inputTy = cast(getInput1().getType()); + auto outputTy = cast(getOutput().getType()); + auto multiplesTy = cast(getMultiples().getType()); + + if (verifySameElementTypes(*this, inputTy, outputTy).failed()) { + return failure(); + } + + if (inputTy.hasRank() && outputTy.hasRank() && + inputTy.getRank() != outputTy.getRank()) { + return emitOpError("expect same input and output tensorARM rank"); + } + + if (inputTy.hasRank() && multiplesTy.hasRank() && + multiplesTy.getShape()[0] != ShapedType::kDynamic && + inputTy.getRank() != multiplesTy.getShape()[0]) { + return emitOpError("expect 'multiples' array to have length ") + << inputTy.getRank() << " but got " << multiplesTy.getShape()[0]; + } + return success(); +} + +//===----------------------------------------------------------------------===// +// spirv.TosaTransposeOp +//===----------------------------------------------------------------------===// +LogicalResult spirv::TosaTransposeOp::verify() { + auto inputTy = cast(getInput1().getType()); + auto outputTy = cast(getOutput().getType()); + auto permsTy = cast(getPerms().getType()); + + if (verifySameElementTypes(*this, inputTy, outputTy).failed()) { + return failure(); + } + + if (inputTy.hasRank() && outputTy.hasRank() && + inputTy.getRank() != outputTy.getRank()) { + return emitOpError("expect same input and output tensorARM rank"); + } + + if (permsTy.hasRank() && permsTy.getRank() != 1) { + return emitOpError( + "expected permutation tensorARM to be rank 1 but got rank ") + << permsTy.getRank(); + } + + if (inputTy.hasRank() && permsTy.getShape()[0] != ShapedType::kDynamic && + inputTy.getRank() != permsTy.getShape()[0]) { + return emitOpError("expect permutation tensorARM to have length ") + << inputTy.getRank() << " but got " << permsTy.getShape()[0]; + } + return success(); +} + +//===----------------------------------------------------------------------===// +// spirv.TosaGatherOp +//===----------------------------------------------------------------------===// +LogicalResult spirv::TosaGatherOp::verify() { + return verifySameElementTypes(*this, getValues().getType(), + getOutput().getType()); +} + +//===----------------------------------------------------------------------===// +// spirv.TosaScatterOp +//===----------------------------------------------------------------------===// +LogicalResult spirv::TosaScatterOp::verify() { + if (verifySameElementTypes(*this, getValuesIn().getType(), + getValuesOut().getType()) + .failed()) { + return failure(); + } + if (verifySameElementTypes(*this, getInput().getType(), + getValuesOut().getType()) + .failed()) { + return failure(); + } + return success(); +} + +//===----------------------------------------------------------------------===// +// spirv.TosaRescaleOp +//===----------------------------------------------------------------------===// + +LogicalResult spirv::TosaRescaleOp::verify() { + auto inputTy = cast(getInput().getType()); + auto outputTy = cast(getOutput().getType()); + + auto inputETy = inputTy.getElementType(); + if (!isa(inputETy)) { + return emitOpError("expect input to have integer element type, got ") + << inputETy; + } + + if (inputTy.hasRank() != outputTy.hasRank() || + (inputTy.hasRank() && inputTy.getShape() != outputTy.getShape())) { + return emitOpError("Shape of input and output must be same"); + } + + auto outputETy = outputTy.getElementType(); + if (!isa(outputETy)) { + return emitOpError("expect output to have integer element type, got ") + << outputETy; + } + + DenseIntElementsAttr inputZpAttr; + if ((getConstAttr(getInputZp(), inputZpAttr).failed())) { + return emitOpError( + "input_zp must be single element tensorARM of an integer constant"); + } + + if (inputZpAttr.size() != 1) { + return emitOpError("input_zp must have a single element"); + } + + auto inputZPETy = inputZpAttr.getElementType(); + if (inputZPETy != inputETy) { + return emitOpError( + "input_zp element type is not same as input element type"); + } + + if (auto inputAPInt = inputZpAttr.getValues()[0]; + !inputAPInt.isZero()) { + if (!inputETy.isInteger(8) && + !(inputETy.isInteger(16) && getInputUnsigned())) { + return emitOpError("expect input_zp of 0, got ") + << inputAPInt.getZExtValue(); + } + if (inputETy.isInteger(16) && getInputUnsigned()) { + if (auto input_zp = inputAPInt.getZExtValue(); input_zp != 32768u) { + return emitOpError("expect input_zp of 0 or 32768 for unsigned int16 " + "input, got ") + << input_zp; + } + } + } + + DenseIntElementsAttr outputZpAttr; + if ((getConstAttr(getOutputZp(), outputZpAttr).failed())) { + return emitOpError( + "output_zp must be single element tensorARM of an integer constant"); + } + + if (outputZpAttr.size() != 1) { + return emitOpError("output_zp must have a single element"); + } + + auto outputZPETy = outputZpAttr.getElementType(); + if (outputZPETy != outputETy) { + return emitOpError( + "output_zp element type is not same as output element type"); + } + + if (auto outputAPInt = outputZpAttr.getValues()[0]; + !outputAPInt.isZero()) { + if (!outputETy.isInteger(8) && + !(outputETy.isInteger(16) && getOutputUnsigned())) { + return emitOpError("expect output_zp of 0, got ") + << outputAPInt.getZExtValue(); + } + if (outputETy.isInteger(16) && getOutputUnsigned()) { + if (auto output_zp = outputAPInt.getZExtValue(); output_zp != 32768u) { + return emitOpError("expect output_zp of 0 or 32768 for unsigned int16 " + "output, got ") + << output_zp; + } + } + } + + auto shiftTy = cast(getShift().getType()); + auto multiplierTy = cast(getMultiplier().getType()); + + auto shiftETy = shiftTy.getElementType(); + if (!shiftETy.isInteger(8)) { + return emitOpError("shift element type must be i8"); + } + + BoolAttr scale32Attr; + if ((getConstAttr(getScale32(), scale32Attr).failed())) { + return emitOpError("scale32 must be a constant boolean"); + } + + auto multiplierETy = multiplierTy.getElementType(); + if (scale32Attr.getValue() && !multiplierETy.isInteger(32)) { + return emitOpError( + "expect i32 element type for multiplier for scale32=true, got ") + << multiplierETy; + } + + if (!scale32Attr.getValue() && !multiplierETy.isInteger(16)) { + return emitOpError( + "expect i16 element type for multiplier for scale32=false, got ") + << multiplierETy; + } + + IntegerAttr roundingModeAttr; + if ((getConstAttr(getRoundingMode(), roundingModeAttr).failed())) { + return emitOpError("rounding_mode must be a constant integer"); + } + + if (auto roundingMode = roundingModeAttr.getInt(); + (roundingMode != 1 && roundingMode != 2 && roundingMode != 3)) { + return emitOpError( + "rounding mode must be an integer of value 1/2/3 " + "corresponding to SINGLE_ROUND/INEXACT_ROUND/DOUBLE_ROUND, got ") + << roundingMode; + } + + BoolAttr perChannelAttr; + if ((getConstAttr(getPerChannel(), perChannelAttr).failed())) { + return emitOpError("per_channel must be a constant boolean"); + } + + // multiplier/shift must have shape = {numChannels}, + // where numChannel is 1 if per_channel = false + // otherwise numChannel is dimension in input shape's last axis + int64_t numChannels = 1; + if (perChannelAttr.getValue()) { + ArrayRef inputShape = inputTy.getShape(); + numChannels = inputTy.hasRank() ? inputShape[inputShape.size() - 1] + : ShapedType::kDynamic; + } + + if (multiplierTy.hasRank() && + multiplierTy.getShape()[0] != ShapedType::kDynamic && + numChannels != ShapedType::kDynamic && + multiplierTy.getShape()[0] != numChannels) { + return emitOpError("expect shape of { ") + << numChannels << " } for multiplier input, got { " + << multiplierTy.getShape()[0] << " }"; + } + + if (shiftTy.hasRank() && shiftTy.getShape()[0] != ShapedType::kDynamic && + numChannels != ShapedType::kDynamic && + shiftTy.getShape()[0] != numChannels) { + return emitOpError("expect shape of { ") + << numChannels << " } for shift input, got { " + << shiftTy.getShape()[0] << " }"; + } + + BoolAttr inputUnsignedAttr; + if ((getConstAttr(getInputUnsigned(), inputUnsignedAttr).failed())) { + return emitOpError("input_unsigned must be a constant boolean"); + } + + BoolAttr outputUnsignedAttr; + if ((getConstAttr(getOutputUnsigned(), outputUnsignedAttr).failed())) { + return emitOpError("output_unsigned must be a constant boolean"); + } + + if (inputETy.isInteger(8) || inputETy.isInteger(16) || + inputETy.isInteger(32) || inputETy.isInteger(64)) { + if (outputETy.isInteger(8) || outputETy.isInteger(16) || + outputETy.isInteger(32)) { + return success(); + } + } + + return emitOpError("input/output element types are incompatible: ") + << inputETy << " and " << outputETy; +} + +//===----------------------------------------------------------------------===// +// spirv.TosaReverseOp +//===----------------------------------------------------------------------===// + +LogicalResult spirv::TosaReverseOp::verify() { + auto inputTy = cast(getInput1().getType()); + auto outputTy = cast(getOutput().getType()); + + if (verifySameElementTypes(*this, inputTy, outputTy).failed()) { + return failure(); + } + + if (inputTy.getRank() != outputTy.getRank()) { + return emitOpError( + "expect output tensorARM rank to be equal to input rank"); + } + + IntegerAttr axisAttr; + if ((getConstAttr(getAxis(), axisAttr).failed())) { + return emitOpError("axis must be a constant integer"); + } + + int32_t reverseAxis = axisAttr.getInt(); + if (reverseAxis < 0) { + return emitOpError("expected non-negative reverse axis"); + } + + if (inputTy.hasRank() && reverseAxis >= inputTy.getRank() && + !(reverseAxis == 0 && inputTy.getRank() == 0)) { + return emitOpError("expect input rank (") + << inputTy.getRank() << ") to be larger than reverse axis (" + << reverseAxis << ")"; + } + + if (outputTy.hasRank() && reverseAxis >= outputTy.getRank() && + !(reverseAxis == 0 && outputTy.getRank() == 0)) { + return emitOpError("expect output tensorARM rank (") + << outputTy.getRank() << ") to be larger than reverse axis (" + << reverseAxis << ")"; + } + return success(); +} + +//===----------------------------------------------------------------------===// +// spirv.TosaSelectOp +//===----------------------------------------------------------------------===// +LogicalResult spirv::TosaSelectOp::verify() { + if (verifySameElementTypes(*this, getInput2().getType(), + getOutput().getType()) + .failed()) { + return failure(); + } + if (verifySameElementTypes(*this, getInput3().getType(), + getOutput().getType()) + .failed()) { + return failure(); + } + + auto predicateType = cast(getInput1().getType()); + if (!predicateType) { + emitOpError("expect shaped tensorARM for input1, got ") + << getInput1().getType(); + return failure(); + } + + auto predicateElementType = predicateType.getElementType(); + if (!predicateElementType.isInteger(1)) { + emitOpError("expect element type of bool for input1, got ") + << predicateElementType; + return failure(); + } + return success(); +} + +//===----------------------------------------------------------------------===// +// spirv.TosaReshapeOp +//===----------------------------------------------------------------------===// + +mlir::LogicalResult spirv::TosaReshapeOp::verify() { + if (verifySameElementTypes(*this, getInput1().getType(), + getOutput().getType()) + .failed()) { + return failure(); + } + ShapedType inputType = cast(getInput1().getType()); + ShapedType outputType = cast(getType()); + + if (inputType.hasStaticShape() && outputType.hasStaticShape()) { + int64_t inputElementsNum = inputType.getNumElements(); + int64_t outputElementsNum = outputType.getNumElements(); + if (inputElementsNum != outputElementsNum) { + return emitOpError() << "Cannot reshape " << inputElementsNum + << " elements into " << outputElementsNum; + } + } + return mlir::success(); +} diff --git a/mlir/test/Dialect/SPIRV/IR/tosa-ops-verification.mlir b/mlir/test/Dialect/SPIRV/IR/tosa-ops-verification.mlir new file mode 100644 index 0000000000000..388f58ba480b9 --- /dev/null +++ b/mlir/test/Dialect/SPIRV/IR/tosa-ops-verification.mlir @@ -0,0 +1,87 @@ +// RUN: mlir-opt --split-input-file --verify-diagnostics %s + +//===----------------------------------------------------------------------===// +// invalid reshape op +//===----------------------------------------------------------------------===// + +spirv.module Logical Vulkan requires #spirv.vce { + spirv.ARM.Graph @reshape(%arg0: !spirv.arm.tensor<16x16xi32>, %arg1: !spirv.arm.tensor<2xi32>) -> (!spirv.arm.tensor<16x4xi32>) { + // expected-error @+1 {{Cannot reshape 256 elements into 64}} + %1 = spirv.Tosa.Reshape %arg0, %arg1: (!spirv.arm.tensor<16x16xi32>, !spirv.arm.tensor<2xi32>) -> !spirv.arm.tensor<16x4xi32> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<16x4xi32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// invalid tosaavgpool2dop +//===----------------------------------------------------------------------===// + +spirv.module Logical Vulkan requires #spirv.vce { + spirv.ARM.Graph @avgpool2d(%arg0: !spirv.arm.tensor<1x11x44x3xi8>, %arg1: !spirv.arm.tensor<1xi8>, %arg2: !spirv.arm.tensor<1xi8>) -> (!spirv.arm.tensor<1x9x42x3xi16>) { + %0 = spirv.Constant dense<3> : !spirv.arm.tensor<2xi32> + %1 = spirv.Constant dense<1> : !spirv.arm.tensor<2xi32> + %2 = spirv.Constant dense<0> : !spirv.arm.tensor<4xi32> + %3 = spirv.Constant 1 : i32 + // expected-error @+1 {{input and output element types must be the same}} + %4 = spirv.Tosa.AvgPool2D %0, %1, %2, %3, %arg0, %arg1, %arg2 : (!spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<4xi32>, i32, !spirv.arm.tensor<1x11x44x3xi8>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<1x9x42x3xi16> + spirv.ARM.GraphOutputs %4 : !spirv.arm.tensor<1x9x42x3xi16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// Invalid Conv2D op: Input and result type mismatch +//===----------------------------------------------------------------------===// + +spirv.module Logical Vulkan requires #spirv.vce { + spirv.ARM.Graph @conv2d_quant_mismatch(%arg0: !spirv.arm.tensor<1x16x16x1xf32>, %arg1: !spirv.arm.tensor<8x3x3x1xi8>, %arg2: !spirv.arm.tensor<8xi32>) -> (!spirv.arm.tensor<1x14x14x8xi32>) { + %0 = spirv.Constant dense<0> : !spirv.arm.tensor<4xi32> + %1 = spirv.Constant dense<1> : !spirv.arm.tensor<2xi32> + %2 = spirv.Constant dense<1> : !spirv.arm.tensor<2xi32> + %3 = spirv.Constant 1 : i32 + %4 = spirv.Constant true + %5 = spirv.Constant dense<0> : !spirv.arm.tensor<1xi8> + %6 = spirv.Constant dense<1> : !spirv.arm.tensor<1xi8> + // expected-error @+1 {{expect result type to be f32, got 'i32'}} + %7 = spirv.Tosa.Conv2D %0, %1, %2, %3, %4, %arg0, %arg1, %arg2, %5, %6 : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, i32, i1, !spirv.arm.tensor<1x16x16x1xf32>, !spirv.arm.tensor<8x3x3x1xi8>, !spirv.arm.tensor<8xi32>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<1x14x14x8xi32> + spirv.ARM.GraphOutputs %7 : !spirv.arm.tensor<1x14x14x8xi32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// Invalid Conv2D op: zero point set bad with quant +//===----------------------------------------------------------------------===// + +spirv.module Logical Vulkan requires #spirv.vce { + spirv.ARM.Graph @conv2d_zero_point_failure(%arg0: !spirv.arm.tensor<1x16x16x1xf32>, %arg1: !spirv.arm.tensor<8x3x3x1xf32>, %arg2: !spirv.arm.tensor<8xf32>) -> (!spirv.arm.tensor<1x14x14x8xf32>) { + %0 = spirv.Constant dense<0> : !spirv.arm.tensor<4xi32> + %1 = spirv.Constant dense<1> : !spirv.arm.tensor<2xi32> + %2 = spirv.Constant dense<1> : !spirv.arm.tensor<2xi32> + %3 = spirv.Constant 1 : i32 + %4 = spirv.Constant true + %5 = spirv.Constant dense<1.0> : !spirv.arm.tensor<1xf32> + %6 = spirv.Constant dense<0.0> : !spirv.arm.tensor<1xf32> + // expected-error @+1 {{input_zp element value must be zero for non-int8 types}} + %7 = spirv.Tosa.Conv2D %0, %1, %2, %3, %4, %arg0, %arg1, %arg2, %5, %6 : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, i32, i1, !spirv.arm.tensor<1x16x16x1xf32>, !spirv.arm.tensor<8x3x3x1xf32>, !spirv.arm.tensor<8xf32>, !spirv.arm.tensor<1xf32>, !spirv.arm.tensor<1xf32>) -> !spirv.arm.tensor<1x14x14x8xf32> + spirv.ARM.GraphOutputs %7 : !spirv.arm.tensor<1x14x14x8xf32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// Invalid MatMul op: Input and result type mismatch +//===----------------------------------------------------------------------===// + +spirv.module Logical Vulkan requires #spirv.vce { + spirv.ARM.Graph @matmul(%arg0: !spirv.arm.tensor<1x4x4xi16>, %arg1: !spirv.arm.tensor<1x4x4xi16>, %arg2: !spirv.arm.tensor<1xi8>, %arg3: !spirv.arm.tensor<1xi8>) -> (!spirv.arm.tensor<1x4x4xi32>) { + // expected-error @+1 {{'spirv.Tosa.MatMul' op expect result element type to be i64, got 'i32'}} + %0 = spirv.Tosa.MatMul %arg0, %arg1, %arg2, %arg3 : (!spirv.arm.tensor<1x4x4xi16>, !spirv.arm.tensor<1x4x4xi16>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<1x4x4xi32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<1x4x4xi32> + } +} diff --git a/mlir/test/Dialect/SPIRV/IR/tosa-ops.mlir b/mlir/test/Dialect/SPIRV/IR/tosa-ops.mlir new file mode 100644 index 0000000000000..23b4bf75f2c0f --- /dev/null +++ b/mlir/test/Dialect/SPIRV/IR/tosa-ops.mlir @@ -0,0 +1,1407 @@ +// RUN: mlir-opt -split-input-file -verify-diagnostics %s | FileCheck %s + +//===----------------------------------------------------------------------===// +// spirv.TOSA.ArgMax - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @argmax_int(%arg0: !spirv.arm.tensor<3x28x17x17xi8>) -> (!spirv.arm.tensor<3x28x17xi32>) { + %0 = spirv.Constant 3 : i32 + %1 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.ArgMax {{%.*}}, {{%.*}}, %arg0 : (i32, i32, !spirv.arm.tensor<3x28x17x17xi8>) -> !spirv.arm.tensor<3x28x17xi32> + %2 = spirv.Tosa.ArgMax %0, %1, %arg0 : (i32, i32, !spirv.arm.tensor<3x28x17x17xi8>) -> !spirv.arm.tensor<3x28x17xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<3x28x17xi32> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<3x28x17xi32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.ArgMax - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @argmax_fp(%arg0: !spirv.arm.tensor<2x2x7x14xf32>) -> (!spirv.arm.tensor<2x2x14xi32>) { + %0 = spirv.Constant 2 : i32 + %1 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.ArgMax {{%.*}}, {{%.*}}, %arg0 : (i32, i32, !spirv.arm.tensor<2x2x7x14xf32>) -> !spirv.arm.tensor<2x2x14xi32> + %2 = spirv.Tosa.ArgMax %0, %1, %arg0 : (i32, i32, !spirv.arm.tensor<2x2x7x14xf32>) -> !spirv.arm.tensor<2x2x14xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<2x2x14xi32> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<2x2x14xi32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.AvgPool2D - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @avgpool2d_int(%arg0: !spirv.arm.tensor<1x3x65537x1xi8>) -> (!spirv.arm.tensor<1x2x32768x1xi8>) { + %0 = spirv.Constant dense<3> : !spirv.arm.tensor<2xi32> + %1 = spirv.Constant dense<[1, 2]> : !spirv.arm.tensor<2xi32> + %2 = spirv.Constant dense<[0, 1, 0, 0]> : !spirv.arm.tensor<4xi32> + %3 = spirv.Constant 1 : i32 + %4 = spirv.Constant dense<125> : !spirv.arm.tensor<1xi8> + %5 = spirv.Constant dense<-90> : !spirv.arm.tensor<1xi8> // CHECK: {{%.*}} = spirv.Tosa.AvgPool2D {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, %arg0, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<4xi32>, i32, !spirv.arm.tensor<1x3x65537x1xi8>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<1x2x32768x1xi8> + %6 = spirv.Tosa.AvgPool2D %0, %1, %2, %3, %arg0, %4, %5 : (!spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<4xi32>, i32, !spirv.arm.tensor<1x3x65537x1xi8>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<1x2x32768x1xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x2x32768x1xi8> + spirv.ARM.GraphOutputs %6 : !spirv.arm.tensor<1x2x32768x1xi8> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.AvgPool2D - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @avgpool2d_fp(%arg0: !spirv.arm.tensor<1x2x65533x2xf32>) -> (!spirv.arm.tensor<1x2x65532x2xf32>) { + %0 = spirv.Constant dense<2> : !spirv.arm.tensor<2xi32> + %1 = spirv.Constant dense<1> : !spirv.arm.tensor<2xi32> + %2 = spirv.Constant dense<[1, 0, 0, 0]> : !spirv.arm.tensor<4xi32> + %3 = spirv.Constant 3 : i32 + %4 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf32> + %5 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf32> // CHECK: {{%.*}} = spirv.Tosa.AvgPool2D {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, %arg0, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<4xi32>, i32, !spirv.arm.tensor<1x2x65533x2xf32>, !spirv.arm.tensor<1xf32>, !spirv.arm.tensor<1xf32>) -> !spirv.arm.tensor<1x2x65532x2xf32> + %6 = spirv.Tosa.AvgPool2D %0, %1, %2, %3, %arg0, %4, %5 : (!spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<4xi32>, i32, !spirv.arm.tensor<1x2x65533x2xf32>, !spirv.arm.tensor<1xf32>, !spirv.arm.tensor<1xf32>) -> !spirv.arm.tensor<1x2x65532x2xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x2x65532x2xf32> + spirv.ARM.GraphOutputs %6 : !spirv.arm.tensor<1x2x65532x2xf32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Conv2D - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @conv2d_int(%arg0: !spirv.arm.tensor<1x65535x3x1xi8>, %arg1: !spirv.arm.tensor<7x1x1x1xi8>, %arg2: !spirv.arm.tensor<1xi32>) -> (!spirv.arm.tensor<1x65536x2x7xi32>) { + %0 = spirv.Constant dense<[1, 0, 0, 0]> : !spirv.arm.tensor<4xi32> + %1 = spirv.Constant dense<[1, 2]> : !spirv.arm.tensor<2xi32> + %2 = spirv.Constant dense<[7, 1]> : !spirv.arm.tensor<2xi32> + %3 = spirv.Constant 1 : i32 + %4 = spirv.Constant false + %5 = spirv.Constant dense<35> : !spirv.arm.tensor<1xi8> + %6 = spirv.Constant dense<57> : !spirv.arm.tensor<1xi8> // CHECK: {{%.*}} = spirv.Tosa.Conv2D {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, %arg0, %arg1, %arg2, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, i32, i1, !spirv.arm.tensor<1x65535x3x1xi8>, !spirv.arm.tensor<7x1x1x1xi8>, !spirv.arm.tensor<1xi32>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<1x65536x2x7xi32> + %7 = spirv.Tosa.Conv2D %0, %1, %2, %3, %4, %arg0, %arg1, %arg2, %5, %6 : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, i32, i1, !spirv.arm.tensor<1x65535x3x1xi8>, !spirv.arm.tensor<7x1x1x1xi8>, !spirv.arm.tensor<1xi32>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<1x65536x2x7xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x65536x2x7xi32> + spirv.ARM.GraphOutputs %7 : !spirv.arm.tensor<1x65536x2x7xi32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Conv2D - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @conv2d_fp(%arg0: !spirv.arm.tensor<1x34x18x27xf16>, %arg1: !spirv.arm.tensor<11x1x1x27xf16>, %arg2: !spirv.arm.tensor<11xf16>) -> (!spirv.arm.tensor<1x34x18x11xf16>) { + %0 = spirv.Constant dense<0> : !spirv.arm.tensor<4xi32> + %1 = spirv.Constant dense<1> : !spirv.arm.tensor<2xi32> + %2 = spirv.Constant dense<1> : !spirv.arm.tensor<2xi32> + %3 = spirv.Constant 2 : i32 + %4 = spirv.Constant true + %5 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf16> + %6 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf16> // CHECK: {{%.*}} = spirv.Tosa.Conv2D {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, %arg0, %arg1, %arg2, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, i32, i1, !spirv.arm.tensor<1x34x18x27xf16>, !spirv.arm.tensor<11x1x1x27xf16>, !spirv.arm.tensor<11xf16>, !spirv.arm.tensor<1xf16>, !spirv.arm.tensor<1xf16>) -> !spirv.arm.tensor<1x34x18x11xf16> + %7 = spirv.Tosa.Conv2D %0, %1, %2, %3, %4, %arg0, %arg1, %arg2, %5, %6 : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, i32, i1, !spirv.arm.tensor<1x34x18x27xf16>, !spirv.arm.tensor<11x1x1x27xf16>, !spirv.arm.tensor<11xf16>, !spirv.arm.tensor<1xf16>, !spirv.arm.tensor<1xf16>) -> !spirv.arm.tensor<1x34x18x11xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x34x18x11xf16> + spirv.ARM.GraphOutputs %7 : !spirv.arm.tensor<1x34x18x11xf16> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Conv3D - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @conv3d_int(%arg0: !spirv.arm.tensor<1x9x21x14x1xi8>, %arg1: !spirv.arm.tensor<2x1x2x1x1xi8>, %arg2: !spirv.arm.tensor<1xi32>) -> (!spirv.arm.tensor<1x9x20x14x2xi32>) { + %0 = spirv.Constant dense<0> : !spirv.arm.tensor<6xi32> + %1 = spirv.Constant dense<1> : !spirv.arm.tensor<3xi32> + %2 = spirv.Constant dense<1> : !spirv.arm.tensor<3xi32> + %3 = spirv.Constant 1 : i32 + %4 = spirv.Constant false + %5 = spirv.Constant dense<123> : !spirv.arm.tensor<1xi8> + %6 = spirv.Constant dense<121> : !spirv.arm.tensor<1xi8> // CHECK: {{%.*}} = spirv.Tosa.Conv3D {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, %arg0, %arg1, %arg2, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<6xi32>, !spirv.arm.tensor<3xi32>, !spirv.arm.tensor<3xi32>, i32, i1, !spirv.arm.tensor<1x9x21x14x1xi8>, !spirv.arm.tensor<2x1x2x1x1xi8>, !spirv.arm.tensor<1xi32>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<1x9x20x14x2xi32> + %7 = spirv.Tosa.Conv3D %0, %1, %2, %3, %4, %arg0, %arg1, %arg2, %5, %6 : (!spirv.arm.tensor<6xi32>, !spirv.arm.tensor<3xi32>, !spirv.arm.tensor<3xi32>, i32, i1, !spirv.arm.tensor<1x9x21x14x1xi8>, !spirv.arm.tensor<2x1x2x1x1xi8>, !spirv.arm.tensor<1xi32>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<1x9x20x14x2xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x9x20x14x2xi32> + spirv.ARM.GraphOutputs %7 : !spirv.arm.tensor<1x9x20x14x2xi32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Conv3D - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @conv3d_fp(%arg0: !spirv.arm.tensor<1x2x65539x1x2xf32>, %arg1: !spirv.arm.tensor<1x1x1x1x2xf32>, %arg2: !spirv.arm.tensor<1xf32>) -> (!spirv.arm.tensor<1x3x65540x2x1xf32>) { + %0 = spirv.Constant dense<[0, 1, 1, 0, 0, 1]> : !spirv.arm.tensor<6xi32> + %1 = spirv.Constant dense<1> : !spirv.arm.tensor<3xi32> + %2 = spirv.Constant dense<[1, 1, 7]> : !spirv.arm.tensor<3xi32> + %3 = spirv.Constant 3 : i32 + %4 = spirv.Constant false + %5 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf32> + %6 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf32> // CHECK: {{%.*}} = spirv.Tosa.Conv3D {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, %arg0, %arg1, %arg2, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<6xi32>, !spirv.arm.tensor<3xi32>, !spirv.arm.tensor<3xi32>, i32, i1, !spirv.arm.tensor<1x2x65539x1x2xf32>, !spirv.arm.tensor<1x1x1x1x2xf32>, !spirv.arm.tensor<1xf32>, !spirv.arm.tensor<1xf32>, !spirv.arm.tensor<1xf32>) -> !spirv.arm.tensor<1x3x65540x2x1xf32> + %7 = spirv.Tosa.Conv3D %0, %1, %2, %3, %4, %arg0, %arg1, %arg2, %5, %6 : (!spirv.arm.tensor<6xi32>, !spirv.arm.tensor<3xi32>, !spirv.arm.tensor<3xi32>, i32, i1, !spirv.arm.tensor<1x2x65539x1x2xf32>, !spirv.arm.tensor<1x1x1x1x2xf32>, !spirv.arm.tensor<1xf32>, !spirv.arm.tensor<1xf32>, !spirv.arm.tensor<1xf32>) -> !spirv.arm.tensor<1x3x65540x2x1xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x3x65540x2x1xf32> + spirv.ARM.GraphOutputs %7 : !spirv.arm.tensor<1x3x65540x2x1xf32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.DepthwiseConv2D - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @depthwiseconv2d_int(%arg0: !spirv.arm.tensor<1x4x65537x1xi8>, %arg1: !spirv.arm.tensor<1x3x1x4xi8>, %arg2: !spirv.arm.tensor<4xi32>) -> (!spirv.arm.tensor<1x4x32762x4xi32>) { + %0 = spirv.Constant dense<0> : !spirv.arm.tensor<4xi32> + %1 = spirv.Constant dense<[1, 2]> : !spirv.arm.tensor<2xi32> + %2 = spirv.Constant dense<7> : !spirv.arm.tensor<2xi32> + %3 = spirv.Constant 1 : i32 + %4 = spirv.Constant false + %5 = spirv.Constant dense<58> : !spirv.arm.tensor<1xi8> + %6 = spirv.Constant dense<-106> : !spirv.arm.tensor<1xi8> // CHECK: {{%.*}} = spirv.Tosa.DepthwiseConv2D {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, %arg0, %arg1, %arg2, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, i32, i1, !spirv.arm.tensor<1x4x65537x1xi8>, !spirv.arm.tensor<1x3x1x4xi8>, !spirv.arm.tensor<4xi32>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<1x4x32762x4xi32> + %7 = spirv.Tosa.DepthwiseConv2D %0, %1, %2, %3, %4, %arg0, %arg1, %arg2, %5, %6 : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, i32, i1, !spirv.arm.tensor<1x4x65537x1xi8>, !spirv.arm.tensor<1x3x1x4xi8>, !spirv.arm.tensor<4xi32>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<1x4x32762x4xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x4x32762x4xi32> + spirv.ARM.GraphOutputs %7 : !spirv.arm.tensor<1x4x32762x4xi32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.DepthwiseConv2D - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @depthwiseconv2d_fp(%arg0: !spirv.arm.tensor<1x65540x1x3xf32>, %arg1: !spirv.arm.tensor<1x1x3x1xf32>, %arg2: !spirv.arm.tensor<1xf32>) -> (!spirv.arm.tensor<1x65541x2x3xf32>) { + %0 = spirv.Constant dense<[0, 1, 1, 1]> : !spirv.arm.tensor<4xi32> + %1 = spirv.Constant dense<[1, 2]> : !spirv.arm.tensor<2xi32> + %2 = spirv.Constant dense<[1, 7]> : !spirv.arm.tensor<2xi32> + %3 = spirv.Constant 3 : i32 + %4 = spirv.Constant true + %5 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf32> + %6 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf32> // CHECK: {{%.*}} = spirv.Tosa.DepthwiseConv2D {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, %arg0, %arg1, %arg2, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, i32, i1, !spirv.arm.tensor<1x65540x1x3xf32>, !spirv.arm.tensor<1x1x3x1xf32>, !spirv.arm.tensor<1xf32>, !spirv.arm.tensor<1xf32>, !spirv.arm.tensor<1xf32>) -> !spirv.arm.tensor<1x65541x2x3xf32> + %7 = spirv.Tosa.DepthwiseConv2D %0, %1, %2, %3, %4, %arg0, %arg1, %arg2, %5, %6 : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, i32, i1, !spirv.arm.tensor<1x65540x1x3xf32>, !spirv.arm.tensor<1x1x3x1xf32>, !spirv.arm.tensor<1xf32>, !spirv.arm.tensor<1xf32>, !spirv.arm.tensor<1xf32>) -> !spirv.arm.tensor<1x65541x2x3xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x65541x2x3xf32> + spirv.ARM.GraphOutputs %7 : !spirv.arm.tensor<1x65541x2x3xf32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.FFT2D - EXT-FFT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @fft2d_fft(%arg0: !spirv.arm.tensor<1x32x32xf32>, %arg1: !spirv.arm.tensor<1x32x32xf32>) -> (!spirv.arm.tensor<1x32x32xf32>, !spirv.arm.tensor<1x32x32xf32>) { + %0 = spirv.Constant true + %1 = spirv.Constant false + // CHECK: {{%.*}} = spirv.Tosa.FFT2D {{%.*}}, {{%.*}}, %arg0, %arg1 : (i1, i1, !spirv.arm.tensor<1x32x32xf32>, !spirv.arm.tensor<1x32x32xf32>) -> !spirv.struct<(!spirv.arm.tensor<1x32x32xf32>, !spirv.arm.tensor<1x32x32xf32>)> + %out = spirv.Tosa.FFT2D %0, %1, %arg0, %arg1 : (i1, i1, !spirv.arm.tensor<1x32x32xf32>, !spirv.arm.tensor<1x32x32xf32>) -> !spirv.struct<(!spirv.arm.tensor<1x32x32xf32>, !spirv.arm.tensor<1x32x32xf32>)> + // CHECK: {{%.*}} = spirv.CompositeExtract {{%.*}}[0 : i32] : !spirv.struct<(!spirv.arm.tensor<1x32x32xf32>, !spirv.arm.tensor<1x32x32xf32>)> + %out0 = spirv.CompositeExtract %out[0 : i32] : !spirv.struct<(!spirv.arm.tensor<1x32x32xf32>, !spirv.arm.tensor<1x32x32xf32>)> + // CHECK: {{%.*}} = spirv.CompositeExtract {{%.*}}[1 : i32] : !spirv.struct<(!spirv.arm.tensor<1x32x32xf32>, !spirv.arm.tensor<1x32x32xf32>)> + %out1 = spirv.CompositeExtract %out[1 : i32] : !spirv.struct<(!spirv.arm.tensor<1x32x32xf32>, !spirv.arm.tensor<1x32x32xf32>)> + // CHECK: spirv.ARM.GraphOutputs {{%.*}}, {{%.*}} : !spirv.arm.tensor<1x32x32xf32>, !spirv.arm.tensor<1x32x32xf32> + spirv.ARM.GraphOutputs %out0, %out1 : !spirv.arm.tensor<1x32x32xf32>, !spirv.arm.tensor<1x32x32xf32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.MatMul - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @matmul_int(%arg0: !spirv.arm.tensor<8x2x3xi8>, %arg1: !spirv.arm.tensor<8x3x8xi8>) -> (!spirv.arm.tensor<8x2x8xi32>) { + %0 = spirv.Constant dense<0> : !spirv.arm.tensor<1xi8> + %1 = spirv.Constant dense<0> : !spirv.arm.tensor<1xi8> // CHECK: {{%.*}} = spirv.Tosa.MatMul %arg0, %arg1, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<8x2x3xi8>, !spirv.arm.tensor<8x3x8xi8>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<8x2x8xi32> + %2 = spirv.Tosa.MatMul %arg0, %arg1, %0, %1 : (!spirv.arm.tensor<8x2x3xi8>, !spirv.arm.tensor<8x3x8xi8>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<8x2x8xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<8x2x8xi32> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<8x2x8xi32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.MatMul - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @matmul_fp(%arg0: !spirv.arm.tensor<15x39x50xf16>, %arg1: !spirv.arm.tensor<15x50x24xf16>) -> (!spirv.arm.tensor<15x39x24xf16>) { + %0 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf16> + %1 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf16> // CHECK: {{%.*}} = spirv.Tosa.MatMul %arg0, %arg1, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<15x39x50xf16>, !spirv.arm.tensor<15x50x24xf16>, !spirv.arm.tensor<1xf16>, !spirv.arm.tensor<1xf16>) -> !spirv.arm.tensor<15x39x24xf16> + %2 = spirv.Tosa.MatMul %arg0, %arg1, %0, %1 : (!spirv.arm.tensor<15x39x50xf16>, !spirv.arm.tensor<15x50x24xf16>, !spirv.arm.tensor<1xf16>, !spirv.arm.tensor<1xf16>) -> !spirv.arm.tensor<15x39x24xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<15x39x24xf16> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<15x39x24xf16> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.MaxPool2D - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @maxpool2d_int(%arg0: !spirv.arm.tensor<1x3x65537x1xi8>) -> (!spirv.arm.tensor<1x2x32769x1xi8>) { + %0 = spirv.Constant dense<[3, 2]> : !spirv.arm.tensor<2xi32> + %1 = spirv.Constant dense<[1, 2]> : !spirv.arm.tensor<2xi32> + %2 = spirv.Constant dense<[1, 0, 0, 1]> : !spirv.arm.tensor<4xi32> + %3 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.MaxPool2D {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, %arg0 : (!spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<4xi32>, i32, !spirv.arm.tensor<1x3x65537x1xi8>) -> !spirv.arm.tensor<1x2x32769x1xi8> + %4 = spirv.Tosa.MaxPool2D %0, %1, %2, %3, %arg0 : (!spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<4xi32>, i32, !spirv.arm.tensor<1x3x65537x1xi8>) -> !spirv.arm.tensor<1x2x32769x1xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x2x32769x1xi8> + spirv.ARM.GraphOutputs %4 : !spirv.arm.tensor<1x2x32769x1xi8> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.MaxPool2D - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @maxpool2d_fp(%arg0: !spirv.arm.tensor<1x6x65536x1xf32>) -> (!spirv.arm.tensor<1x3x32769x1xf32>) { + %0 = spirv.Constant dense<[3, 2]> : !spirv.arm.tensor<2xi32> + %1 = spirv.Constant dense<2> : !spirv.arm.tensor<2xi32> + %2 = spirv.Constant dense<[1, 0, 1, 1]> : !spirv.arm.tensor<4xi32> + %3 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.MaxPool2D {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, %arg0 : (!spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<4xi32>, i32, !spirv.arm.tensor<1x6x65536x1xf32>) -> !spirv.arm.tensor<1x3x32769x1xf32> + %4 = spirv.Tosa.MaxPool2D %0, %1, %2, %3, %arg0 : (!spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<4xi32>, i32, !spirv.arm.tensor<1x6x65536x1xf32>) -> !spirv.arm.tensor<1x3x32769x1xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x3x32769x1xf32> + spirv.ARM.GraphOutputs %4 : !spirv.arm.tensor<1x3x32769x1xf32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.RFFT2D - EXT-FFT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @rfft2d_fft(%arg0: !spirv.arm.tensor<1x32x32xf32>) -> (!spirv.arm.tensor<1x32x17xf32>, !spirv.arm.tensor<1x32x17xf32>) { + %0 = spirv.Constant false + // CHECK: {{%.*}} = spirv.Tosa.RFFT2D {{%.*}}, %arg0 : (i1, !spirv.arm.tensor<1x32x32xf32>) -> !spirv.struct<(!spirv.arm.tensor<1x32x17xf32>, !spirv.arm.tensor<1x32x17xf32>)> + %out = spirv.Tosa.RFFT2D %0, %arg0 : (i1, !spirv.arm.tensor<1x32x32xf32>) -> !spirv.struct<(!spirv.arm.tensor<1x32x17xf32>, !spirv.arm.tensor<1x32x17xf32>)> + // CHECK: {{%.*}} = spirv.CompositeExtract {{%.*}}[0 : i32] : !spirv.struct<(!spirv.arm.tensor<1x32x17xf32>, !spirv.arm.tensor<1x32x17xf32>)> + %out0 = spirv.CompositeExtract %out[0 : i32] : !spirv.struct<(!spirv.arm.tensor<1x32x17xf32>, !spirv.arm.tensor<1x32x17xf32>)> + // CHECK: {{%.*}} = spirv.CompositeExtract {{%.*}}[1 : i32] : !spirv.struct<(!spirv.arm.tensor<1x32x17xf32>, !spirv.arm.tensor<1x32x17xf32>)> + %out1 = spirv.CompositeExtract %out[1 : i32] : !spirv.struct<(!spirv.arm.tensor<1x32x17xf32>, !spirv.arm.tensor<1x32x17xf32>)> + // CHECK: spirv.ARM.GraphOutputs {{%.*}}, {{%.*}} : !spirv.arm.tensor<1x32x17xf32>, !spirv.arm.tensor<1x32x17xf32> + spirv.ARM.GraphOutputs %out0, %out1 : !spirv.arm.tensor<1x32x17xf32>, !spirv.arm.tensor<1x32x17xf32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.TransposeConv2D - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @transposeconv2d_int(%arg0: !spirv.arm.tensor<1x13x33x3xi16>, %arg1: !spirv.arm.tensor<11x1x3x3xi8>, %arg2: !spirv.arm.tensor<1xi64>) -> (!spirv.arm.tensor<1x13x35x11xi64>) { + %0 = spirv.Constant dense<0> : !spirv.arm.tensor<4xi32> + %1 = spirv.Constant dense<1> : !spirv.arm.tensor<2xi32> + %2 = spirv.Constant 4 : i32 + %3 = spirv.Constant false + %4 = spirv.Constant dense<0> : !spirv.arm.tensor<1xi16> + %5 = spirv.Constant dense<88> : !spirv.arm.tensor<1xi8> // CHECK: {{%.*}} = spirv.Tosa.TransposeConv2D {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, %arg0, %arg1, %arg2, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, i32, i1, !spirv.arm.tensor<1x13x33x3xi16>, !spirv.arm.tensor<11x1x3x3xi8>, !spirv.arm.tensor<1xi64>, !spirv.arm.tensor<1xi16>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<1x13x35x11xi64> + %6 = spirv.Tosa.TransposeConv2D %0, %1, %2, %3, %arg0, %arg1, %arg2, %4, %5 : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, i32, i1, !spirv.arm.tensor<1x13x33x3xi16>, !spirv.arm.tensor<11x1x3x3xi8>, !spirv.arm.tensor<1xi64>, !spirv.arm.tensor<1xi16>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<1x13x35x11xi64> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x13x35x11xi64> + spirv.ARM.GraphOutputs %6 : !spirv.arm.tensor<1x13x35x11xi64> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.TransposeConv2D - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @transposeconv2d_fp(%arg0: !spirv.arm.tensor<10x24x9x13xf16>, %arg1: !spirv.arm.tensor<14x1x1x13xf16>, %arg2: !spirv.arm.tensor<14xf16>) -> (!spirv.arm.tensor<10x25x65x14xf16>) { + %0 = spirv.Constant dense<[0, 1, 0, 0]> : !spirv.arm.tensor<4xi32> + %1 = spirv.Constant dense<[1, 8]> : !spirv.arm.tensor<2xi32> + %2 = spirv.Constant 2 : i32 + %3 = spirv.Constant true + %4 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf16> + %5 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf16> // CHECK: {{%.*}} = spirv.Tosa.TransposeConv2D {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, %arg0, %arg1, %arg2, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, i32, i1, !spirv.arm.tensor<10x24x9x13xf16>, !spirv.arm.tensor<14x1x1x13xf16>, !spirv.arm.tensor<14xf16>, !spirv.arm.tensor<1xf16>, !spirv.arm.tensor<1xf16>) -> !spirv.arm.tensor<10x25x65x14xf16> + %6 = spirv.Tosa.TransposeConv2D %0, %1, %2, %3, %arg0, %arg1, %arg2, %4, %5 : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, i32, i1, !spirv.arm.tensor<10x24x9x13xf16>, !spirv.arm.tensor<14x1x1x13xf16>, !spirv.arm.tensor<14xf16>, !spirv.arm.tensor<1xf16>, !spirv.arm.tensor<1xf16>) -> !spirv.arm.tensor<10x25x65x14xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<10x25x65x14xf16> + spirv.ARM.GraphOutputs %6 : !spirv.arm.tensor<10x25x65x14xf16> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Clamp - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @clamp_int(%arg0: !spirv.arm.tensor<27x44x55xi8>) -> (!spirv.arm.tensor<27x44x55xi8>) { + %0 = spirv.Constant -102 : i8 + %1 = spirv.Constant -100 : i8 + %2 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.Clamp {{%.*}}, {{%.*}}, {{%.*}}, %arg0 : (i8, i8, i32, !spirv.arm.tensor<27x44x55xi8>) -> !spirv.arm.tensor<27x44x55xi8> + %3 = spirv.Tosa.Clamp %0, %1, %2, %arg0 : (i8, i8, i32, !spirv.arm.tensor<27x44x55xi8>) -> !spirv.arm.tensor<27x44x55xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<27x44x55xi8> + spirv.ARM.GraphOutputs %3 : !spirv.arm.tensor<27x44x55xi8> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Clamp - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @clamp_fp(%arg0: !spirv.arm.tensor<18x5x17x6xf32>) -> (!spirv.arm.tensor<18x5x17x6xf32>) { + %0 = spirv.Constant -1.193394e+38 : f32 + %1 = spirv.Constant 2.3825594e+38 : f32 + %2 = spirv.Constant 2 : i32 // CHECK: {{%.*}} = spirv.Tosa.Clamp {{%.*}}, {{%.*}}, {{%.*}}, %arg0 : (f32, f32, i32, !spirv.arm.tensor<18x5x17x6xf32>) -> !spirv.arm.tensor<18x5x17x6xf32> + %3 = spirv.Tosa.Clamp %0, %1, %2, %arg0 : (f32, f32, i32, !spirv.arm.tensor<18x5x17x6xf32>) -> !spirv.arm.tensor<18x5x17x6xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<18x5x17x6xf32> + spirv.ARM.GraphOutputs %3 : !spirv.arm.tensor<18x5x17x6xf32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Erf - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @erf_fp(%arg0: !spirv.arm.tensor<47x38x51xf32>) -> (!spirv.arm.tensor<47x38x51xf32>) { + // CHECK: {{%.*}} = spirv.Tosa.Erf %arg0 : (!spirv.arm.tensor<47x38x51xf32>) -> !spirv.arm.tensor<47x38x51xf32> + %0 = spirv.Tosa.Erf %arg0 : (!spirv.arm.tensor<47x38x51xf32>) -> !spirv.arm.tensor<47x38x51xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<47x38x51xf32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<47x38x51xf32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Sigmoid - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @sigmoid_fp(%arg0: !spirv.arm.tensor<28x43x45xf32>) -> (!spirv.arm.tensor<28x43x45xf32>) { + // CHECK: {{%.*}} = spirv.Tosa.Sigmoid %arg0 : (!spirv.arm.tensor<28x43x45xf32>) -> !spirv.arm.tensor<28x43x45xf32> + %0 = spirv.Tosa.Sigmoid %arg0 : (!spirv.arm.tensor<28x43x45xf32>) -> !spirv.arm.tensor<28x43x45xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<28x43x45xf32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<28x43x45xf32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Tanh - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @tanh_fp(%arg0: !spirv.arm.tensor<46x50x36xf16>) -> (!spirv.arm.tensor<46x50x36xf16>) { + // CHECK: {{%.*}} = spirv.Tosa.Tanh %arg0 : (!spirv.arm.tensor<46x50x36xf16>) -> !spirv.arm.tensor<46x50x36xf16> + %0 = spirv.Tosa.Tanh %arg0 : (!spirv.arm.tensor<46x50x36xf16>) -> !spirv.arm.tensor<46x50x36xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<46x50x36xf16> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<46x50x36xf16> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Add - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @add_int(%arg0: !spirv.arm.tensor<4x7x3x10xi32>, %arg1: !spirv.arm.tensor<4x7x3x1xi32>) -> (!spirv.arm.tensor<4x7x3x10xi32>) { + // CHECK: {{%.*}} = spirv.Tosa.Add %arg0, %arg1 : (!spirv.arm.tensor<4x7x3x10xi32>, !spirv.arm.tensor<4x7x3x1xi32>) -> !spirv.arm.tensor<4x7x3x10xi32> + %0 = spirv.Tosa.Add %arg0, %arg1 : (!spirv.arm.tensor<4x7x3x10xi32>, !spirv.arm.tensor<4x7x3x1xi32>) -> !spirv.arm.tensor<4x7x3x10xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<4x7x3x10xi32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<4x7x3x10xi32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Add - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @add_fp(%arg0: !spirv.arm.tensor<26x37x18xf16>, %arg1: !spirv.arm.tensor<1x37x18xf16>) -> (!spirv.arm.tensor<26x37x18xf16>) { + // CHECK: {{%.*}} = spirv.Tosa.Add %arg0, %arg1 : (!spirv.arm.tensor<26x37x18xf16>, !spirv.arm.tensor<1x37x18xf16>) -> !spirv.arm.tensor<26x37x18xf16> + %0 = spirv.Tosa.Add %arg0, %arg1 : (!spirv.arm.tensor<26x37x18xf16>, !spirv.arm.tensor<1x37x18xf16>) -> !spirv.arm.tensor<26x37x18xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<26x37x18xf16> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<26x37x18xf16> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.ArithmeticRightShift - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @arithmeticrightshift_int(%arg0: !spirv.arm.tensor<1x47x22xi16>, %arg1: !spirv.arm.tensor<49x47x22xi16>) -> (!spirv.arm.tensor<49x47x22xi16>) { + %0 = spirv.Constant true // CHECK: {{%.*}} = spirv.Tosa.ArithmeticRightShift {{%.*}}, %arg0, %arg1 : (i1, !spirv.arm.tensor<1x47x22xi16>, !spirv.arm.tensor<49x47x22xi16>) -> !spirv.arm.tensor<49x47x22xi16> + %1 = spirv.Tosa.ArithmeticRightShift %0, %arg0, %arg1 : (i1, !spirv.arm.tensor<1x47x22xi16>, !spirv.arm.tensor<49x47x22xi16>) -> !spirv.arm.tensor<49x47x22xi16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<49x47x22xi16> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<49x47x22xi16> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.BitwiseAnd - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @bitwiseand_int(%arg0: !spirv.arm.tensor<4x1x7x12xi16>, %arg1: !spirv.arm.tensor<4x13x7x12xi16>) -> (!spirv.arm.tensor<4x13x7x12xi16>) { + // CHECK: {{%.*}} = spirv.Tosa.BitwiseAnd %arg0, %arg1 : (!spirv.arm.tensor<4x1x7x12xi16>, !spirv.arm.tensor<4x13x7x12xi16>) -> !spirv.arm.tensor<4x13x7x12xi16> + %0 = spirv.Tosa.BitwiseAnd %arg0, %arg1 : (!spirv.arm.tensor<4x1x7x12xi16>, !spirv.arm.tensor<4x13x7x12xi16>) -> !spirv.arm.tensor<4x13x7x12xi16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<4x13x7x12xi16> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<4x13x7x12xi16> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.BitwiseOr - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @bitwiseor_int(%arg0: !spirv.arm.tensor<11x30x23xi32>, %arg1: !spirv.arm.tensor<1x30x23xi32>) -> (!spirv.arm.tensor<11x30x23xi32>) { + // CHECK: {{%.*}} = spirv.Tosa.BitwiseOr %arg0, %arg1 : (!spirv.arm.tensor<11x30x23xi32>, !spirv.arm.tensor<1x30x23xi32>) -> !spirv.arm.tensor<11x30x23xi32> + %0 = spirv.Tosa.BitwiseOr %arg0, %arg1 : (!spirv.arm.tensor<11x30x23xi32>, !spirv.arm.tensor<1x30x23xi32>) -> !spirv.arm.tensor<11x30x23xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<11x30x23xi32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<11x30x23xi32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.BitwiseXor - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @bitwisexor_int(%arg0: !spirv.arm.tensor<4x8x13x9xi16>, %arg1: !spirv.arm.tensor<4x8x1x9xi16>) -> (!spirv.arm.tensor<4x8x13x9xi16>) { + // CHECK: {{%.*}} = spirv.Tosa.BitwiseXor %arg0, %arg1 : (!spirv.arm.tensor<4x8x13x9xi16>, !spirv.arm.tensor<4x8x1x9xi16>) -> !spirv.arm.tensor<4x8x13x9xi16> + %0 = spirv.Tosa.BitwiseXor %arg0, %arg1 : (!spirv.arm.tensor<4x8x13x9xi16>, !spirv.arm.tensor<4x8x1x9xi16>) -> !spirv.arm.tensor<4x8x13x9xi16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<4x8x13x9xi16> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<4x8x13x9xi16> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.IntDiv - PRO-INT or PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @intdiv_any(%arg0: !spirv.arm.tensor<1x65533x1xi32>, %arg1: !spirv.arm.tensor<2x65533x1xi32>) -> (!spirv.arm.tensor<2x65533x1xi32>) { + // CHECK: {{%.*}} = spirv.Tosa.IntDiv %arg0, %arg1 : (!spirv.arm.tensor<1x65533x1xi32>, !spirv.arm.tensor<2x65533x1xi32>) -> !spirv.arm.tensor<2x65533x1xi32> + %0 = spirv.Tosa.IntDiv %arg0, %arg1 : (!spirv.arm.tensor<1x65533x1xi32>, !spirv.arm.tensor<2x65533x1xi32>) -> !spirv.arm.tensor<2x65533x1xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<2x65533x1xi32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<2x65533x1xi32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.LogicalAnd - PRO-INT or PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @logicaland_any(%arg0: !spirv.arm.tensor<2x1x7x11xi1>, %arg1: !spirv.arm.tensor<2x4x7x11xi1>) -> (!spirv.arm.tensor<2x4x7x11xi1>) { + // CHECK: {{%.*}} = spirv.Tosa.LogicalAnd %arg0, %arg1 : (!spirv.arm.tensor<2x1x7x11xi1>, !spirv.arm.tensor<2x4x7x11xi1>) -> !spirv.arm.tensor<2x4x7x11xi1> + %0 = spirv.Tosa.LogicalAnd %arg0, %arg1 : (!spirv.arm.tensor<2x1x7x11xi1>, !spirv.arm.tensor<2x4x7x11xi1>) -> !spirv.arm.tensor<2x4x7x11xi1> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<2x4x7x11xi1> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<2x4x7x11xi1> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.LogicalLeftShift - PRO-INT or PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @logicalleftshift_any(%arg0: !spirv.arm.tensor<7x1x11x4xi8>, %arg1: !spirv.arm.tensor<7x8x11x4xi8>) -> (!spirv.arm.tensor<7x8x11x4xi8>) { + // CHECK: {{%.*}} = spirv.Tosa.LogicalLeftShift %arg0, %arg1 : (!spirv.arm.tensor<7x1x11x4xi8>, !spirv.arm.tensor<7x8x11x4xi8>) -> !spirv.arm.tensor<7x8x11x4xi8> + %0 = spirv.Tosa.LogicalLeftShift %arg0, %arg1 : (!spirv.arm.tensor<7x1x11x4xi8>, !spirv.arm.tensor<7x8x11x4xi8>) -> !spirv.arm.tensor<7x8x11x4xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<7x8x11x4xi8> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<7x8x11x4xi8> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.LogicalRightShift - PRO-INT or PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @logicalrightshift_any(%arg0: !spirv.arm.tensor<6x13x1x19xi8>, %arg1: !spirv.arm.tensor<6x13x6x19xi8>) -> (!spirv.arm.tensor<6x13x6x19xi8>) { + // CHECK: {{%.*}} = spirv.Tosa.LogicalRightShift %arg0, %arg1 : (!spirv.arm.tensor<6x13x1x19xi8>, !spirv.arm.tensor<6x13x6x19xi8>) -> !spirv.arm.tensor<6x13x6x19xi8> + %0 = spirv.Tosa.LogicalRightShift %arg0, %arg1 : (!spirv.arm.tensor<6x13x1x19xi8>, !spirv.arm.tensor<6x13x6x19xi8>) -> !spirv.arm.tensor<6x13x6x19xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<6x13x6x19xi8> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<6x13x6x19xi8> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.LogicalOr - PRO-INT or PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @logicalor_any(%arg0: !spirv.arm.tensor<3x6x12x5xi1>, %arg1: !spirv.arm.tensor<3x6x1x5xi1>) -> (!spirv.arm.tensor<3x6x12x5xi1>) { + // CHECK: {{%.*}} = spirv.Tosa.LogicalOr %arg0, %arg1 : (!spirv.arm.tensor<3x6x12x5xi1>, !spirv.arm.tensor<3x6x1x5xi1>) -> !spirv.arm.tensor<3x6x12x5xi1> + %0 = spirv.Tosa.LogicalOr %arg0, %arg1 : (!spirv.arm.tensor<3x6x12x5xi1>, !spirv.arm.tensor<3x6x1x5xi1>) -> !spirv.arm.tensor<3x6x12x5xi1> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<3x6x12x5xi1> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<3x6x12x5xi1> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.LogicalXor - PRO-INT or PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @logicalxor_any(%arg0: !spirv.arm.tensor<11x4x9x12xi1>, %arg1: !spirv.arm.tensor<11x4x9x1xi1>) -> (!spirv.arm.tensor<11x4x9x12xi1>) { + // CHECK: {{%.*}} = spirv.Tosa.LogicalXor %arg0, %arg1 : (!spirv.arm.tensor<11x4x9x12xi1>, !spirv.arm.tensor<11x4x9x1xi1>) -> !spirv.arm.tensor<11x4x9x12xi1> + %0 = spirv.Tosa.LogicalXor %arg0, %arg1 : (!spirv.arm.tensor<11x4x9x12xi1>, !spirv.arm.tensor<11x4x9x1xi1>) -> !spirv.arm.tensor<11x4x9x12xi1> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<11x4x9x12xi1> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<11x4x9x12xi1> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Maximum - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @maximum_int(%arg0: !spirv.arm.tensor<1x2x65533x1xi32>, %arg1: !spirv.arm.tensor<1x2x65533x2xi32>) -> (!spirv.arm.tensor<1x2x65533x2xi32>) { + %0 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.Maximum {{%.*}}, %arg0, %arg1 : (i32, !spirv.arm.tensor<1x2x65533x1xi32>, !spirv.arm.tensor<1x2x65533x2xi32>) -> !spirv.arm.tensor<1x2x65533x2xi32> + %1 = spirv.Tosa.Maximum %0, %arg0, %arg1 : (i32, !spirv.arm.tensor<1x2x65533x1xi32>, !spirv.arm.tensor<1x2x65533x2xi32>) -> !spirv.arm.tensor<1x2x65533x2xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x2x65533x2xi32> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<1x2x65533x2xi32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Maximum - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @maximum_fp(%arg0: !spirv.arm.tensor<1x12x14x7xf16>, %arg1: !spirv.arm.tensor<11x12x14x7xf16>) -> (!spirv.arm.tensor<11x12x14x7xf16>) { + %0 = spirv.Constant 2 : i32 // CHECK: {{%.*}} = spirv.Tosa.Maximum {{%.*}}, %arg0, %arg1 : (i32, !spirv.arm.tensor<1x12x14x7xf16>, !spirv.arm.tensor<11x12x14x7xf16>) -> !spirv.arm.tensor<11x12x14x7xf16> + %1 = spirv.Tosa.Maximum %0, %arg0, %arg1 : (i32, !spirv.arm.tensor<1x12x14x7xf16>, !spirv.arm.tensor<11x12x14x7xf16>) -> !spirv.arm.tensor<11x12x14x7xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<11x12x14x7xf16> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<11x12x14x7xf16> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Minimum - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @minimum_int(%arg0: !spirv.arm.tensor<15x2x10x11xi32>, %arg1: !spirv.arm.tensor<15x1x10x11xi32>) -> (!spirv.arm.tensor<15x2x10x11xi32>) { + %0 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.Minimum {{%.*}}, %arg0, %arg1 : (i32, !spirv.arm.tensor<15x2x10x11xi32>, !spirv.arm.tensor<15x1x10x11xi32>) -> !spirv.arm.tensor<15x2x10x11xi32> + %1 = spirv.Tosa.Minimum %0, %arg0, %arg1 : (i32, !spirv.arm.tensor<15x2x10x11xi32>, !spirv.arm.tensor<15x1x10x11xi32>) -> !spirv.arm.tensor<15x2x10x11xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<15x2x10x11xi32> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<15x2x10x11xi32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Minimum - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @minimum_fp(%arg0: !spirv.arm.tensor<1x65531x2x1xf32>, %arg1: !spirv.arm.tensor<1x1x2x1xf32>) -> (!spirv.arm.tensor<1x65531x2x1xf32>) { + %0 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.Minimum {{%.*}}, %arg0, %arg1 : (i32, !spirv.arm.tensor<1x65531x2x1xf32>, !spirv.arm.tensor<1x1x2x1xf32>) -> !spirv.arm.tensor<1x65531x2x1xf32> + %1 = spirv.Tosa.Minimum %0, %arg0, %arg1 : (i32, !spirv.arm.tensor<1x65531x2x1xf32>, !spirv.arm.tensor<1x1x2x1xf32>) -> !spirv.arm.tensor<1x65531x2x1xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x65531x2x1xf32> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<1x65531x2x1xf32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Mul - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @mul_int(%arg0: !spirv.arm.tensor<34x21x39xi32>, %arg1: !spirv.arm.tensor<34x21x1xi32>) -> (!spirv.arm.tensor<34x21x39xi32>) { + %0 = spirv.Constant dense<31> : !spirv.arm.tensor<1xi8> // CHECK: {{%.*}} = spirv.Tosa.Mul %arg0, %arg1, {{%.*}} : (!spirv.arm.tensor<34x21x39xi32>, !spirv.arm.tensor<34x21x1xi32>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<34x21x39xi32> + %1 = spirv.Tosa.Mul %arg0, %arg1, %0 : (!spirv.arm.tensor<34x21x39xi32>, !spirv.arm.tensor<34x21x1xi32>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<34x21x39xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<34x21x39xi32> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<34x21x39xi32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Mul - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @mul_fp(%arg0: !spirv.arm.tensor<57x1x55xf16>, %arg1: !spirv.arm.tensor<57x37x55xf16>) -> (!spirv.arm.tensor<57x37x55xf16>) { + %0 = spirv.Constant dense<0> : !spirv.arm.tensor<1xi8> // CHECK: {{%.*}} = spirv.Tosa.Mul %arg0, %arg1, {{%.*}} : (!spirv.arm.tensor<57x1x55xf16>, !spirv.arm.tensor<57x37x55xf16>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<57x37x55xf16> + %1 = spirv.Tosa.Mul %arg0, %arg1, %0 : (!spirv.arm.tensor<57x1x55xf16>, !spirv.arm.tensor<57x37x55xf16>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<57x37x55xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<57x37x55xf16> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<57x37x55xf16> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Pow - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @pow_fp(%arg0: !spirv.arm.tensor<1x52x53xf16>, %arg1: !spirv.arm.tensor<44x52x53xf16>) -> (!spirv.arm.tensor<44x52x53xf16>) { + // CHECK: {{%.*}} = spirv.Tosa.Pow %arg0, %arg1 : (!spirv.arm.tensor<1x52x53xf16>, !spirv.arm.tensor<44x52x53xf16>) -> !spirv.arm.tensor<44x52x53xf16> + %0 = spirv.Tosa.Pow %arg0, %arg1 : (!spirv.arm.tensor<1x52x53xf16>, !spirv.arm.tensor<44x52x53xf16>) -> !spirv.arm.tensor<44x52x53xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<44x52x53xf16> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<44x52x53xf16> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Sub - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @sub_int(%arg0: !spirv.arm.tensor<6x10x6x6xi32>, %arg1: !spirv.arm.tensor<1x10x6x6xi32>) -> (!spirv.arm.tensor<6x10x6x6xi32>) { + // CHECK: {{%.*}} = spirv.Tosa.Sub %arg0, %arg1 : (!spirv.arm.tensor<6x10x6x6xi32>, !spirv.arm.tensor<1x10x6x6xi32>) -> !spirv.arm.tensor<6x10x6x6xi32> + %0 = spirv.Tosa.Sub %arg0, %arg1 : (!spirv.arm.tensor<6x10x6x6xi32>, !spirv.arm.tensor<1x10x6x6xi32>) -> !spirv.arm.tensor<6x10x6x6xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<6x10x6x6xi32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<6x10x6x6xi32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Sub - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @sub_fp(%arg0: !spirv.arm.tensor<1x10x13x12xf16>, %arg1: !spirv.arm.tensor<6x10x13x12xf16>) -> (!spirv.arm.tensor<6x10x13x12xf16>) { + // CHECK: {{%.*}} = spirv.Tosa.Sub %arg0, %arg1 : (!spirv.arm.tensor<1x10x13x12xf16>, !spirv.arm.tensor<6x10x13x12xf16>) -> !spirv.arm.tensor<6x10x13x12xf16> + %0 = spirv.Tosa.Sub %arg0, %arg1 : (!spirv.arm.tensor<1x10x13x12xf16>, !spirv.arm.tensor<6x10x13x12xf16>) -> !spirv.arm.tensor<6x10x13x12xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<6x10x13x12xf16> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<6x10x13x12xf16> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Table - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @table_int(%arg0: !spirv.arm.tensor<3x2x15x7xi8>) -> (!spirv.arm.tensor<3x2x15x7xi8>) { + %0 = spirv.ARM.GraphConstant {graph_constant_id = 0 : i32} : !spirv.arm.tensor<256xi8> + // CHECK: {{%.*}} = spirv.Tosa.Table %arg0, {{%.*}} : (!spirv.arm.tensor<3x2x15x7xi8>, !spirv.arm.tensor<256xi8>) -> !spirv.arm.tensor<3x2x15x7xi8> + %1 = spirv.Tosa.Table %arg0, %0 : (!spirv.arm.tensor<3x2x15x7xi8>, !spirv.arm.tensor<256xi8>) -> !spirv.arm.tensor<3x2x15x7xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<3x2x15x7xi8> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<3x2x15x7xi8> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Abs - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @abs_int(%arg0: !spirv.arm.tensor<5x1x4x4xi32>) -> (!spirv.arm.tensor<5x1x4x4xi32>) { + // CHECK: {{%.*}} = spirv.Tosa.Abs %arg0 : (!spirv.arm.tensor<5x1x4x4xi32>) -> !spirv.arm.tensor<5x1x4x4xi32> + %0 = spirv.Tosa.Abs %arg0 : (!spirv.arm.tensor<5x1x4x4xi32>) -> !spirv.arm.tensor<5x1x4x4xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<5x1x4x4xi32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<5x1x4x4xi32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Abs - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @abs_fp(%arg0: !spirv.arm.tensor<3x6x14x8xf16>) -> (!spirv.arm.tensor<3x6x14x8xf16>) { + // CHECK: {{%.*}} = spirv.Tosa.Abs %arg0 : (!spirv.arm.tensor<3x6x14x8xf16>) -> !spirv.arm.tensor<3x6x14x8xf16> + %0 = spirv.Tosa.Abs %arg0 : (!spirv.arm.tensor<3x6x14x8xf16>) -> !spirv.arm.tensor<3x6x14x8xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<3x6x14x8xf16> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<3x6x14x8xf16> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.BitwiseNot - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @bitwisenot_int(%arg0: !spirv.arm.tensor<12x56x50xi32>) -> (!spirv.arm.tensor<12x56x50xi32>) { + // CHECK: {{%.*}} = spirv.Tosa.BitwiseNot %arg0 : (!spirv.arm.tensor<12x56x50xi32>) -> !spirv.arm.tensor<12x56x50xi32> + %0 = spirv.Tosa.BitwiseNot %arg0 : (!spirv.arm.tensor<12x56x50xi32>) -> !spirv.arm.tensor<12x56x50xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<12x56x50xi32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<12x56x50xi32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Ceil - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @ceil_fp(%arg0: !spirv.arm.tensor<46x55x53xf16>) -> (!spirv.arm.tensor<46x55x53xf16>) { + // CHECK: {{%.*}} = spirv.Tosa.Ceil %arg0 : (!spirv.arm.tensor<46x55x53xf16>) -> !spirv.arm.tensor<46x55x53xf16> + %0 = spirv.Tosa.Ceil %arg0 : (!spirv.arm.tensor<46x55x53xf16>) -> !spirv.arm.tensor<46x55x53xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<46x55x53xf16> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<46x55x53xf16> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Clz - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @clz_int(%arg0: !spirv.arm.tensor<14x10x7x5xi32>) -> (!spirv.arm.tensor<14x10x7x5xi32>) { + // CHECK: {{%.*}} = spirv.Tosa.Clz %arg0 : (!spirv.arm.tensor<14x10x7x5xi32>) -> !spirv.arm.tensor<14x10x7x5xi32> + %0 = spirv.Tosa.Clz %arg0 : (!spirv.arm.tensor<14x10x7x5xi32>) -> !spirv.arm.tensor<14x10x7x5xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<14x10x7x5xi32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<14x10x7x5xi32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Cos - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @cos_fp(%arg0: !spirv.arm.tensor<44x49x51xf32>) -> (!spirv.arm.tensor<44x49x51xf32>) { + // CHECK: {{%.*}} = spirv.Tosa.Cos %arg0 : (!spirv.arm.tensor<44x49x51xf32>) -> !spirv.arm.tensor<44x49x51xf32> + %0 = spirv.Tosa.Cos %arg0 : (!spirv.arm.tensor<44x49x51xf32>) -> !spirv.arm.tensor<44x49x51xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<44x49x51xf32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<44x49x51xf32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Exp - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @exp_fp(%arg0: !spirv.arm.tensor<37x53x47xf32>) -> (!spirv.arm.tensor<37x53x47xf32>) { + // CHECK: {{%.*}} = spirv.Tosa.Exp %arg0 : (!spirv.arm.tensor<37x53x47xf32>) -> !spirv.arm.tensor<37x53x47xf32> + %0 = spirv.Tosa.Exp %arg0 : (!spirv.arm.tensor<37x53x47xf32>) -> !spirv.arm.tensor<37x53x47xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<37x53x47xf32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<37x53x47xf32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Floor - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @floor_fp(%arg0: !spirv.arm.tensor<40x52x42xf32>) -> (!spirv.arm.tensor<40x52x42xf32>) { + // CHECK: {{%.*}} = spirv.Tosa.Floor %arg0 : (!spirv.arm.tensor<40x52x42xf32>) -> !spirv.arm.tensor<40x52x42xf32> + %0 = spirv.Tosa.Floor %arg0 : (!spirv.arm.tensor<40x52x42xf32>) -> !spirv.arm.tensor<40x52x42xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<40x52x42xf32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<40x52x42xf32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Log - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @log_fp(%arg0: !spirv.arm.tensor<45x43x36xf16>) -> (!spirv.arm.tensor<45x43x36xf16>) { + // CHECK: {{%.*}} = spirv.Tosa.Log %arg0 : (!spirv.arm.tensor<45x43x36xf16>) -> !spirv.arm.tensor<45x43x36xf16> + %0 = spirv.Tosa.Log %arg0 : (!spirv.arm.tensor<45x43x36xf16>) -> !spirv.arm.tensor<45x43x36xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<45x43x36xf16> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<45x43x36xf16> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.LogicalNot - PRO-INT or PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @logicalnot_any(%arg0: !spirv.arm.tensor<54x26x10xi1>) -> (!spirv.arm.tensor<54x26x10xi1>) { + // CHECK: {{%.*}} = spirv.Tosa.LogicalNot %arg0 : (!spirv.arm.tensor<54x26x10xi1>) -> !spirv.arm.tensor<54x26x10xi1> + %0 = spirv.Tosa.LogicalNot %arg0 : (!spirv.arm.tensor<54x26x10xi1>) -> !spirv.arm.tensor<54x26x10xi1> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<54x26x10xi1> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<54x26x10xi1> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Negate - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @negate_int(%arg0: !spirv.arm.tensor<3x1x65540x1xi8>) -> (!spirv.arm.tensor<3x1x65540x1xi8>) { + %0 = spirv.Constant dense<111> : !spirv.arm.tensor<1xi8> + %1 = spirv.Constant dense<-32> : !spirv.arm.tensor<1xi8> // CHECK: {{%.*}} = spirv.Tosa.Negate %arg0, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<3x1x65540x1xi8>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<3x1x65540x1xi8> + %2 = spirv.Tosa.Negate %arg0, %0, %1 : (!spirv.arm.tensor<3x1x65540x1xi8>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<3x1x65540x1xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<3x1x65540x1xi8> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<3x1x65540x1xi8> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Negate - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @negate_fp(%arg0: !spirv.arm.tensor<2x7x15x13xf16>) -> (!spirv.arm.tensor<2x7x15x13xf16>) { + %0 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf16> + %1 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf16> // CHECK: {{%.*}} = spirv.Tosa.Negate %arg0, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<2x7x15x13xf16>, !spirv.arm.tensor<1xf16>, !spirv.arm.tensor<1xf16>) -> !spirv.arm.tensor<2x7x15x13xf16> + %2 = spirv.Tosa.Negate %arg0, %0, %1 : (!spirv.arm.tensor<2x7x15x13xf16>, !spirv.arm.tensor<1xf16>, !spirv.arm.tensor<1xf16>) -> !spirv.arm.tensor<2x7x15x13xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<2x7x15x13xf16> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<2x7x15x13xf16> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Reciprocal - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @reciprocal_fp(%arg0: !spirv.arm.tensor<38x47x44xf32>) -> (!spirv.arm.tensor<38x47x44xf32>) { + // CHECK: {{%.*}} = spirv.Tosa.Reciprocal %arg0 : (!spirv.arm.tensor<38x47x44xf32>) -> !spirv.arm.tensor<38x47x44xf32> + %0 = spirv.Tosa.Reciprocal %arg0 : (!spirv.arm.tensor<38x47x44xf32>) -> !spirv.arm.tensor<38x47x44xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<38x47x44xf32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<38x47x44xf32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Rsqrt - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @rsqrt_fp(%arg0: !spirv.arm.tensor<40x57x56xf32>) -> (!spirv.arm.tensor<40x57x56xf32>) { + // CHECK: {{%.*}} = spirv.Tosa.Rsqrt %arg0 : (!spirv.arm.tensor<40x57x56xf32>) -> !spirv.arm.tensor<40x57x56xf32> + %0 = spirv.Tosa.Rsqrt %arg0 : (!spirv.arm.tensor<40x57x56xf32>) -> !spirv.arm.tensor<40x57x56xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<40x57x56xf32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<40x57x56xf32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Sin - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @sin_fp(%arg0: !spirv.arm.tensor<49x38x58xf16>) -> (!spirv.arm.tensor<49x38x58xf16>) { + // CHECK: {{%.*}} = spirv.Tosa.Sin %arg0 : (!spirv.arm.tensor<49x38x58xf16>) -> !spirv.arm.tensor<49x38x58xf16> + %0 = spirv.Tosa.Sin %arg0 : (!spirv.arm.tensor<49x38x58xf16>) -> !spirv.arm.tensor<49x38x58xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<49x38x58xf16> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<49x38x58xf16> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Select - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @select_int(%arg0: !spirv.arm.tensor<4x1x4x5xi1>, %arg1: !spirv.arm.tensor<4x6x4x5xi8>, %arg2: !spirv.arm.tensor<4x6x4x5xi8>) -> (!spirv.arm.tensor<4x6x4x5xi8>) { + // CHECK: {{%.*}} = spirv.Tosa.Select %arg0, %arg1, %arg2 : (!spirv.arm.tensor<4x1x4x5xi1>, !spirv.arm.tensor<4x6x4x5xi8>, !spirv.arm.tensor<4x6x4x5xi8>) -> !spirv.arm.tensor<4x6x4x5xi8> + %0 = spirv.Tosa.Select %arg0, %arg1, %arg2 : (!spirv.arm.tensor<4x1x4x5xi1>, !spirv.arm.tensor<4x6x4x5xi8>, !spirv.arm.tensor<4x6x4x5xi8>) -> !spirv.arm.tensor<4x6x4x5xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<4x6x4x5xi8> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<4x6x4x5xi8> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Select - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @select_fp(%arg0: !spirv.arm.tensor<9x2x15x8xi1>, %arg1: !spirv.arm.tensor<9x2x15x8xf16>, %arg2: !spirv.arm.tensor<9x1x15x8xf16>) -> (!spirv.arm.tensor<9x2x15x8xf16>) { + // CHECK: {{%.*}} = spirv.Tosa.Select %arg0, %arg1, %arg2 : (!spirv.arm.tensor<9x2x15x8xi1>, !spirv.arm.tensor<9x2x15x8xf16>, !spirv.arm.tensor<9x1x15x8xf16>) -> !spirv.arm.tensor<9x2x15x8xf16> + %0 = spirv.Tosa.Select %arg0, %arg1, %arg2 : (!spirv.arm.tensor<9x2x15x8xi1>, !spirv.arm.tensor<9x2x15x8xf16>, !spirv.arm.tensor<9x1x15x8xf16>) -> !spirv.arm.tensor<9x2x15x8xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<9x2x15x8xf16> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<9x2x15x8xf16> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Equal - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @equal_int(%arg0: !spirv.arm.tensor<51x28x59xi32>, %arg1: !spirv.arm.tensor<51x1x59xi32>) -> (!spirv.arm.tensor<51x28x59xi1>) { + // CHECK: {{%.*}} = spirv.Tosa.Equal %arg0, %arg1 : (!spirv.arm.tensor<51x28x59xi32>, !spirv.arm.tensor<51x1x59xi32>) -> !spirv.arm.tensor<51x28x59xi1> + %0 = spirv.Tosa.Equal %arg0, %arg1 : (!spirv.arm.tensor<51x28x59xi32>, !spirv.arm.tensor<51x1x59xi32>) -> !spirv.arm.tensor<51x28x59xi1> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<51x28x59xi1> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<51x28x59xi1> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Equal - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @equal_fp(%arg0: !spirv.arm.tensor<16x11x5x3xf32>, %arg1: !spirv.arm.tensor<16x1x5x3xf32>) -> (!spirv.arm.tensor<16x11x5x3xi1>) { + // CHECK: {{%.*}} = spirv.Tosa.Equal %arg0, %arg1 : (!spirv.arm.tensor<16x11x5x3xf32>, !spirv.arm.tensor<16x1x5x3xf32>) -> !spirv.arm.tensor<16x11x5x3xi1> + %0 = spirv.Tosa.Equal %arg0, %arg1 : (!spirv.arm.tensor<16x11x5x3xf32>, !spirv.arm.tensor<16x1x5x3xf32>) -> !spirv.arm.tensor<16x11x5x3xi1> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<16x11x5x3xi1> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<16x11x5x3xi1> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Greater - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @greater_int(%arg0: !spirv.arm.tensor<11x10x10x2xi32>, %arg1: !spirv.arm.tensor<11x10x10x1xi32>) -> (!spirv.arm.tensor<11x10x10x2xi1>) { + // CHECK: {{%.*}} = spirv.Tosa.Greater %arg0, %arg1 : (!spirv.arm.tensor<11x10x10x2xi32>, !spirv.arm.tensor<11x10x10x1xi32>) -> !spirv.arm.tensor<11x10x10x2xi1> + %0 = spirv.Tosa.Greater %arg0, %arg1 : (!spirv.arm.tensor<11x10x10x2xi32>, !spirv.arm.tensor<11x10x10x1xi32>) -> !spirv.arm.tensor<11x10x10x2xi1> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<11x10x10x2xi1> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<11x10x10x2xi1> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Greater - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @greater_fp(%arg0: !spirv.arm.tensor<6x3x12x4xf16>, %arg1: !spirv.arm.tensor<6x3x1x4xf16>) -> (!spirv.arm.tensor<6x3x12x4xi1>) { + // CHECK: {{%.*}} = spirv.Tosa.Greater %arg0, %arg1 : (!spirv.arm.tensor<6x3x12x4xf16>, !spirv.arm.tensor<6x3x1x4xf16>) -> !spirv.arm.tensor<6x3x12x4xi1> + %0 = spirv.Tosa.Greater %arg0, %arg1 : (!spirv.arm.tensor<6x3x12x4xf16>, !spirv.arm.tensor<6x3x1x4xf16>) -> !spirv.arm.tensor<6x3x12x4xi1> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<6x3x12x4xi1> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<6x3x12x4xi1> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.GreaterEqual - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @greaterequal_int(%arg0: !spirv.arm.tensor<10x17x7x1xi32>, %arg1: !spirv.arm.tensor<10x17x7x16xi32>) -> (!spirv.arm.tensor<10x17x7x16xi1>) { + // CHECK: {{%.*}} = spirv.Tosa.GreaterEqual %arg0, %arg1 : (!spirv.arm.tensor<10x17x7x1xi32>, !spirv.arm.tensor<10x17x7x16xi32>) -> !spirv.arm.tensor<10x17x7x16xi1> + %0 = spirv.Tosa.GreaterEqual %arg0, %arg1 : (!spirv.arm.tensor<10x17x7x1xi32>, !spirv.arm.tensor<10x17x7x16xi32>) -> !spirv.arm.tensor<10x17x7x16xi1> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<10x17x7x16xi1> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<10x17x7x16xi1> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.GreaterEqual - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @greaterequal_fp(%arg0: !spirv.arm.tensor<3x17x6x3xf32>, %arg1: !spirv.arm.tensor<1x17x6x3xf32>) -> (!spirv.arm.tensor<3x17x6x3xi1>) { + // CHECK: {{%.*}} = spirv.Tosa.GreaterEqual %arg0, %arg1 : (!spirv.arm.tensor<3x17x6x3xf32>, !spirv.arm.tensor<1x17x6x3xf32>) -> !spirv.arm.tensor<3x17x6x3xi1> + %0 = spirv.Tosa.GreaterEqual %arg0, %arg1 : (!spirv.arm.tensor<3x17x6x3xf32>, !spirv.arm.tensor<1x17x6x3xf32>) -> !spirv.arm.tensor<3x17x6x3xi1> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<3x17x6x3xi1> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<3x17x6x3xi1> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.ReduceAll - PRO-INT or PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @reduceall_any(%arg0: !spirv.arm.tensor<18x22x23x12xi1>) -> (!spirv.arm.tensor<18x22x1x12xi1>) { + %0 = spirv.Constant 2 : i32 // CHECK: {{%.*}} = spirv.Tosa.ReduceAll {{%.*}}, %arg0 : (i32, !spirv.arm.tensor<18x22x23x12xi1>) -> !spirv.arm.tensor<18x22x1x12xi1> + %1 = spirv.Tosa.ReduceAll %0, %arg0 : (i32, !spirv.arm.tensor<18x22x23x12xi1>) -> !spirv.arm.tensor<18x22x1x12xi1> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<18x22x1x12xi1> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<18x22x1x12xi1> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.ReduceAny - PRO-INT or PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @reduceany_any(%arg0: !spirv.arm.tensor<25x13x30x8xi1>) -> (!spirv.arm.tensor<25x13x1x8xi1>) { + %0 = spirv.Constant 2 : i32 // CHECK: {{%.*}} = spirv.Tosa.ReduceAny {{%.*}}, %arg0 : (i32, !spirv.arm.tensor<25x13x30x8xi1>) -> !spirv.arm.tensor<25x13x1x8xi1> + %1 = spirv.Tosa.ReduceAny %0, %arg0 : (i32, !spirv.arm.tensor<25x13x30x8xi1>) -> !spirv.arm.tensor<25x13x1x8xi1> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<25x13x1x8xi1> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<25x13x1x8xi1> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.ReduceMax - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @reducemax_int(%arg0: !spirv.arm.tensor<8x30x12x3xi8>) -> (!spirv.arm.tensor<8x30x1x3xi8>) { + %0 = spirv.Constant 2 : i32 + %1 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.ReduceMax {{%.*}}, {{%.*}}, %arg0 : (i32, i32, !spirv.arm.tensor<8x30x12x3xi8>) -> !spirv.arm.tensor<8x30x1x3xi8> + %2 = spirv.Tosa.ReduceMax %0, %1, %arg0 : (i32, i32, !spirv.arm.tensor<8x30x12x3xi8>) -> !spirv.arm.tensor<8x30x1x3xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<8x30x1x3xi8> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<8x30x1x3xi8> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.ReduceMax - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @reducemax_fp(%arg0: !spirv.arm.tensor<16x20x10xf16>) -> (!spirv.arm.tensor<16x20x1xf16>) { + %0 = spirv.Constant 2 : i32 + %1 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.ReduceMax {{%.*}}, {{%.*}}, %arg0 : (i32, i32, !spirv.arm.tensor<16x20x10xf16>) -> !spirv.arm.tensor<16x20x1xf16> + %2 = spirv.Tosa.ReduceMax %0, %1, %arg0 : (i32, i32, !spirv.arm.tensor<16x20x10xf16>) -> !spirv.arm.tensor<16x20x1xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<16x20x1xf16> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<16x20x1xf16> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.ReduceMin - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @reducemin_int(%arg0: !spirv.arm.tensor<2x5x5x1xi8>) -> (!spirv.arm.tensor<2x5x1x1xi8>) { + %0 = spirv.Constant 2 : i32 + %1 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.ReduceMin {{%.*}}, {{%.*}}, %arg0 : (i32, i32, !spirv.arm.tensor<2x5x5x1xi8>) -> !spirv.arm.tensor<2x5x1x1xi8> + %2 = spirv.Tosa.ReduceMin %0, %1, %arg0 : (i32, i32, !spirv.arm.tensor<2x5x5x1xi8>) -> !spirv.arm.tensor<2x5x1x1xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<2x5x1x1xi8> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<2x5x1x1xi8> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.ReduceMin - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @reducemin_fp(%arg0: !spirv.arm.tensor<27x10x25x9xf16>) -> (!spirv.arm.tensor<27x10x1x9xf16>) { + %0 = spirv.Constant 2 : i32 + %1 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.ReduceMin {{%.*}}, {{%.*}}, %arg0 : (i32, i32, !spirv.arm.tensor<27x10x25x9xf16>) -> !spirv.arm.tensor<27x10x1x9xf16> + %2 = spirv.Tosa.ReduceMin %0, %1, %arg0 : (i32, i32, !spirv.arm.tensor<27x10x25x9xf16>) -> !spirv.arm.tensor<27x10x1x9xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<27x10x1x9xf16> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<27x10x1x9xf16> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.ReduceProduct - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @reduceproduct_fp(%arg0: !spirv.arm.tensor<2x16x25xf16>) -> (!spirv.arm.tensor<2x16x1xf16>) { + %0 = spirv.Constant 2 : i32 // CHECK: {{%.*}} = spirv.Tosa.ReduceProduct {{%.*}}, %arg0 : (i32, !spirv.arm.tensor<2x16x25xf16>) -> !spirv.arm.tensor<2x16x1xf16> + %1 = spirv.Tosa.ReduceProduct %0, %arg0 : (i32, !spirv.arm.tensor<2x16x25xf16>) -> !spirv.arm.tensor<2x16x1xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<2x16x1xf16> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<2x16x1xf16> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.ReduceSum - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @reducesum_int(%arg0: !spirv.arm.tensor<20x24x22xi32>) -> (!spirv.arm.tensor<20x1x22xi32>) { + %0 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.ReduceSum {{%.*}}, %arg0 : (i32, !spirv.arm.tensor<20x24x22xi32>) -> !spirv.arm.tensor<20x1x22xi32> + %1 = spirv.Tosa.ReduceSum %0, %arg0 : (i32, !spirv.arm.tensor<20x24x22xi32>) -> !spirv.arm.tensor<20x1x22xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<20x1x22xi32> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<20x1x22xi32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.ReduceSum - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @reducesum_fp(%arg0: !spirv.arm.tensor<32x32x33xf32>) -> (!spirv.arm.tensor<32x1x33xf32>) { + %0 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.ReduceSum {{%.*}}, %arg0 : (i32, !spirv.arm.tensor<32x32x33xf32>) -> !spirv.arm.tensor<32x1x33xf32> + %1 = spirv.Tosa.ReduceSum %0, %arg0 : (i32, !spirv.arm.tensor<32x32x33xf32>) -> !spirv.arm.tensor<32x1x33xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<32x1x33xf32> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<32x1x33xf32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Concat - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @concat_int(%arg0: !spirv.arm.tensor<12x13x3x14xi8>, %arg1: !spirv.arm.tensor<12x13x3x14xi8>, %arg2: !spirv.arm.tensor<12x13x3x14xi8>, %arg3: !spirv.arm.tensor<12x13x3x14xi8>) -> (!spirv.arm.tensor<12x13x12x14xi8>) { + %0 = spirv.Constant 2 : i32 + // CHECK: {{%.*}} = spirv.Tosa.Concat {{%.*}}, %arg0, %arg1, %arg2, %arg3 : (i32, !spirv.arm.tensor<12x13x3x14xi8>, !spirv.arm.tensor<12x13x3x14xi8>, !spirv.arm.tensor<12x13x3x14xi8>, !spirv.arm.tensor<12x13x3x14xi8>) -> !spirv.arm.tensor<12x13x12x14xi8> + %1 = spirv.Tosa.Concat %0, %arg0, %arg1, %arg2, %arg3 : (i32, !spirv.arm.tensor<12x13x3x14xi8>, !spirv.arm.tensor<12x13x3x14xi8>, !spirv.arm.tensor<12x13x3x14xi8>, !spirv.arm.tensor<12x13x3x14xi8>) -> !spirv.arm.tensor<12x13x12x14xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<12x13x12x14xi8> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<12x13x12x14xi8> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Concat - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @concat_fp(%arg0: !spirv.arm.tensor<40x31x19xf32>, %arg1: !spirv.arm.tensor<40x15x19xf32>, %arg2: !spirv.arm.tensor<40x16x19xf32>) -> (!spirv.arm.tensor<40x62x19xf32>) { + %0 = spirv.Constant 1 : i32 + // CHECK: {{%.*}} = spirv.Tosa.Concat {{%.*}}, %arg0, %arg1, %arg2 : (i32, !spirv.arm.tensor<40x31x19xf32>, !spirv.arm.tensor<40x15x19xf32>, !spirv.arm.tensor<40x16x19xf32>) -> !spirv.arm.tensor<40x62x19xf32> + %1 = spirv.Tosa.Concat %0, %arg0, %arg1, %arg2 : (i32, !spirv.arm.tensor<40x31x19xf32>, !spirv.arm.tensor<40x15x19xf32>, !spirv.arm.tensor<40x16x19xf32>) -> !spirv.arm.tensor<40x62x19xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<40x62x19xf32> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<40x62x19xf32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Pad - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @pad_int(%arg0: !spirv.arm.tensor<4x7xi8>) -> (!spirv.arm.tensor<21x19xi8>) { + %0 = spirv.Constant dense<[10, 7, 6, 6]> : !spirv.arm.tensor<4xi32> + %1 = spirv.Constant dense<-76> : !spirv.arm.tensor<1xi8> // CHECK: {{%.*}} = spirv.Tosa.Pad %arg0, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<4x7xi8>, !spirv.arm.tensor<4xi32>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<21x19xi8> + %2 = spirv.Tosa.Pad %arg0, %0, %1 : (!spirv.arm.tensor<4x7xi8>, !spirv.arm.tensor<4xi32>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<21x19xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<21x19xi8> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<21x19xi8> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Pad - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @pad_fp(%arg0: !spirv.arm.tensor<2x9x2x3xf32>) -> (!spirv.arm.tensor<4x9x4x4xf32>) { + %0 = spirv.Constant dense<[1, 1, 0, 0, 1, 1, 0, 1]> : !spirv.arm.tensor<8xi32> + %1 = spirv.Constant dense<1.216309e+38> : !spirv.arm.tensor<1xf32> // CHECK: {{%.*}} = spirv.Tosa.Pad %arg0, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<2x9x2x3xf32>, !spirv.arm.tensor<8xi32>, !spirv.arm.tensor<1xf32>) -> !spirv.arm.tensor<4x9x4x4xf32> + %2 = spirv.Tosa.Pad %arg0, %0, %1 : (!spirv.arm.tensor<2x9x2x3xf32>, !spirv.arm.tensor<8xi32>, !spirv.arm.tensor<1xf32>) -> !spirv.arm.tensor<4x9x4x4xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<4x9x4x4xf32> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<4x9x4x4xf32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Reshape - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @reshape_int(%arg0: !spirv.arm.tensor<25x6x29x35xi16>) -> (!spirv.arm.tensor<125x6x7x29xi16>) { + %0 = spirv.Constant dense<[125, 6, 7, 29]> : !spirv.arm.tensor<4xi32> // CHECK: {{%.*}} = spirv.Tosa.Reshape %arg0, {{%.*}} : (!spirv.arm.tensor<25x6x29x35xi16>, !spirv.arm.tensor<4xi32>) -> !spirv.arm.tensor<125x6x7x29xi16> + %1 = spirv.Tosa.Reshape %arg0, %0 : (!spirv.arm.tensor<25x6x29x35xi16>, !spirv.arm.tensor<4xi32>) -> !spirv.arm.tensor<125x6x7x29xi16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<125x6x7x29xi16> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<125x6x7x29xi16> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Reshape - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @reshape_fp(%arg0: !spirv.arm.tensor<1x2x7x2xf32>) -> (!spirv.arm.tensor<2x1x14xf32>) { + %0 = spirv.Constant dense<[2, 1, 14]> : !spirv.arm.tensor<3xi32> // CHECK: {{%.*}} = spirv.Tosa.Reshape %arg0, {{%.*}} : (!spirv.arm.tensor<1x2x7x2xf32>, !spirv.arm.tensor<3xi32>) -> !spirv.arm.tensor<2x1x14xf32> + %1 = spirv.Tosa.Reshape %arg0, %0 : (!spirv.arm.tensor<1x2x7x2xf32>, !spirv.arm.tensor<3xi32>) -> !spirv.arm.tensor<2x1x14xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<2x1x14xf32> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<2x1x14xf32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Reverse - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @reverse_int(%arg0: !spirv.arm.tensor<20x5x28x31xi32>) -> (!spirv.arm.tensor<20x5x28x31xi32>) { + %0 = spirv.Constant 2 : i32 // CHECK: {{%.*}} = spirv.Tosa.Reverse {{%.*}}, %arg0 : (i32, !spirv.arm.tensor<20x5x28x31xi32>) -> !spirv.arm.tensor<20x5x28x31xi32> + %1 = spirv.Tosa.Reverse %0, %arg0 : (i32, !spirv.arm.tensor<20x5x28x31xi32>) -> !spirv.arm.tensor<20x5x28x31xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<20x5x28x31xi32> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<20x5x28x31xi32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Reverse - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @reverse_fp(%arg0: !spirv.arm.tensor<21x34x47xf32>) -> (!spirv.arm.tensor<21x34x47xf32>) { + %0 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.Reverse {{%.*}}, %arg0 : (i32, !spirv.arm.tensor<21x34x47xf32>) -> !spirv.arm.tensor<21x34x47xf32> + %1 = spirv.Tosa.Reverse %0, %arg0 : (i32, !spirv.arm.tensor<21x34x47xf32>) -> !spirv.arm.tensor<21x34x47xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<21x34x47xf32> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<21x34x47xf32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Slice - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @slice_int(%arg0: !spirv.arm.tensor<32x19x41xi8>) -> (!spirv.arm.tensor<21x5x2xi8>) { + %0 = spirv.Constant dense<[8, 11, 39]> : !spirv.arm.tensor<3xi32> + %1 = spirv.Constant dense<[21, 5, 2]> : !spirv.arm.tensor<3xi32> // CHECK: {{%.*}} = spirv.Tosa.Slice %arg0, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<32x19x41xi8>, !spirv.arm.tensor<3xi32>, !spirv.arm.tensor<3xi32>) -> !spirv.arm.tensor<21x5x2xi8> + %2 = spirv.Tosa.Slice %arg0, %0, %1 : (!spirv.arm.tensor<32x19x41xi8>, !spirv.arm.tensor<3xi32>, !spirv.arm.tensor<3xi32>) -> !spirv.arm.tensor<21x5x2xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<21x5x2xi8> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<21x5x2xi8> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Slice - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @slice_fp(%arg0: !spirv.arm.tensor<30x45x29xf32>) -> (!spirv.arm.tensor<5x12x11xf32>) { + %0 = spirv.Constant dense<[21, 20, 10]> : !spirv.arm.tensor<3xi32> + %1 = spirv.Constant dense<[5, 12, 11]> : !spirv.arm.tensor<3xi32> // CHECK: {{%.*}} = spirv.Tosa.Slice %arg0, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<30x45x29xf32>, !spirv.arm.tensor<3xi32>, !spirv.arm.tensor<3xi32>) -> !spirv.arm.tensor<5x12x11xf32> + %2 = spirv.Tosa.Slice %arg0, %0, %1 : (!spirv.arm.tensor<30x45x29xf32>, !spirv.arm.tensor<3xi32>, !spirv.arm.tensor<3xi32>) -> !spirv.arm.tensor<5x12x11xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<5x12x11xf32> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<5x12x11xf32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Tile - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @tile_int(%arg0: !spirv.arm.tensor<10x28x21xi16>) -> (!spirv.arm.tensor<10x28x63xi16>) { + %0 = spirv.Constant dense<[1, 1, 3]> : !spirv.arm.tensor<3xi32> // CHECK: {{%.*}} = spirv.Tosa.Tile %arg0, {{%.*}} : (!spirv.arm.tensor<10x28x21xi16>, !spirv.arm.tensor<3xi32>) -> !spirv.arm.tensor<10x28x63xi16> + %1 = spirv.Tosa.Tile %arg0, %0 : (!spirv.arm.tensor<10x28x21xi16>, !spirv.arm.tensor<3xi32>) -> !spirv.arm.tensor<10x28x63xi16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<10x28x63xi16> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<10x28x63xi16> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Tile - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @tile_fp(%arg0: !spirv.arm.tensor<31x19x5xf16>) -> (!spirv.arm.tensor<62x57x10xf16>) { + %0 = spirv.Constant dense<[2, 3, 2]> : !spirv.arm.tensor<3xi32> // CHECK: {{%.*}} = spirv.Tosa.Tile %arg0, {{%.*}} : (!spirv.arm.tensor<31x19x5xf16>, !spirv.arm.tensor<3xi32>) -> !spirv.arm.tensor<62x57x10xf16> + %1 = spirv.Tosa.Tile %arg0, %0 : (!spirv.arm.tensor<31x19x5xf16>, !spirv.arm.tensor<3xi32>) -> !spirv.arm.tensor<62x57x10xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<62x57x10xf16> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<62x57x10xf16> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Transpose - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @transpose_int(%arg0: !spirv.arm.tensor<14x28x1x61xi16>) -> (!spirv.arm.tensor<1x14x28x61xi16>) { + %0 = spirv.Constant dense<[2, 0, 1, 3]> : !spirv.arm.tensor<4xi32> // CHECK: {{%.*}} = spirv.Tosa.Transpose {{%.*}}, %arg0 : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<14x28x1x61xi16>) -> !spirv.arm.tensor<1x14x28x61xi16> + %1 = spirv.Tosa.Transpose %0, %arg0 : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<14x28x1x61xi16>) -> !spirv.arm.tensor<1x14x28x61xi16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x14x28x61xi16> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<1x14x28x61xi16> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Transpose - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @transpose_fp(%arg0: !spirv.arm.tensor<42x22x49xi1>) -> (!spirv.arm.tensor<49x42x22xi1>) { + %0 = spirv.Constant dense<[2, 0, 1]> : !spirv.arm.tensor<3xi32> // CHECK: {{%.*}} = spirv.Tosa.Transpose {{%.*}}, %arg0 : (!spirv.arm.tensor<3xi32>, !spirv.arm.tensor<42x22x49xi1>) -> !spirv.arm.tensor<49x42x22xi1> + %1 = spirv.Tosa.Transpose %0, %arg0 : (!spirv.arm.tensor<3xi32>, !spirv.arm.tensor<42x22x49xi1>) -> !spirv.arm.tensor<49x42x22xi1> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<49x42x22xi1> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<49x42x22xi1> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Gather - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @gather_int(%arg0: !spirv.arm.tensor<31x11x45xi32>, %arg1: !spirv.arm.tensor<31x15xi32>) -> (!spirv.arm.tensor<31x15x45xi32>) { + // CHECK: {{%.*}} = spirv.Tosa.Gather %arg0, %arg1 : (!spirv.arm.tensor<31x11x45xi32>, !spirv.arm.tensor<31x15xi32>) -> !spirv.arm.tensor<31x15x45xi32> + %0 = spirv.Tosa.Gather %arg0, %arg1 : (!spirv.arm.tensor<31x11x45xi32>, !spirv.arm.tensor<31x15xi32>) -> !spirv.arm.tensor<31x15x45xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<31x15x45xi32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<31x15x45xi32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Gather - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @gather_fp(%arg0: !spirv.arm.tensor<59x61x19xf32>, %arg1: !spirv.arm.tensor<59x65xi32>) -> (!spirv.arm.tensor<59x65x19xf32>) { + // CHECK: {{%.*}} = spirv.Tosa.Gather %arg0, %arg1 : (!spirv.arm.tensor<59x61x19xf32>, !spirv.arm.tensor<59x65xi32>) -> !spirv.arm.tensor<59x65x19xf32> + %0 = spirv.Tosa.Gather %arg0, %arg1 : (!spirv.arm.tensor<59x61x19xf32>, !spirv.arm.tensor<59x65xi32>) -> !spirv.arm.tensor<59x65x19xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<59x65x19xf32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<59x65x19xf32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Scatter - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @scatter_int(%arg0: !spirv.arm.tensor<34x28x54xi32>, %arg1: !spirv.arm.tensor<34x18xi32>, %arg2: !spirv.arm.tensor<34x18x54xi32>) -> (!spirv.arm.tensor<34x28x54xi32>) { + // CHECK: {{%.*}} = spirv.Tosa.Scatter %arg0, %arg1, %arg2 : (!spirv.arm.tensor<34x28x54xi32>, !spirv.arm.tensor<34x18xi32>, !spirv.arm.tensor<34x18x54xi32>) -> !spirv.arm.tensor<34x28x54xi32> + %0 = spirv.Tosa.Scatter %arg0, %arg1, %arg2 : (!spirv.arm.tensor<34x28x54xi32>, !spirv.arm.tensor<34x18xi32>, !spirv.arm.tensor<34x18x54xi32>) -> !spirv.arm.tensor<34x28x54xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<34x28x54xi32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<34x28x54xi32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Scatter - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @scatter_fp(%arg0: !spirv.arm.tensor<18x34x25xf16>, %arg1: !spirv.arm.tensor<18x20xi32>, %arg2: !spirv.arm.tensor<18x20x25xf16>) -> (!spirv.arm.tensor<18x34x25xf16>) { + // CHECK: {{%.*}} = spirv.Tosa.Scatter %arg0, %arg1, %arg2 : (!spirv.arm.tensor<18x34x25xf16>, !spirv.arm.tensor<18x20xi32>, !spirv.arm.tensor<18x20x25xf16>) -> !spirv.arm.tensor<18x34x25xf16> + %0 = spirv.Tosa.Scatter %arg0, %arg1, %arg2 : (!spirv.arm.tensor<18x34x25xf16>, !spirv.arm.tensor<18x20xi32>, !spirv.arm.tensor<18x20x25xf16>) -> !spirv.arm.tensor<18x34x25xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<18x34x25xf16> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<18x34x25xf16> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Resize - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @resize_int(%arg0: !spirv.arm.tensor<1x1x31x55xi8>) -> (!spirv.arm.tensor<1x1x278x55xi8>) { + %0 = spirv.Constant 1 : i32 + %1 = spirv.Constant dense<[16, 1, 9, 1]> : !spirv.arm.tensor<4xi32> + %2 = spirv.Constant dense<0> : !spirv.arm.tensor<2xi32> + %3 = spirv.Constant dense<[0, 7]> : !spirv.arm.tensor<2xi32> // CHECK: {{%.*}} = spirv.Tosa.Resize {{%.*}}, %arg0, {{%.*}}, {{%.*}}, {{%.*}} : (i32, !spirv.arm.tensor<1x1x31x55xi8>, !spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>) -> !spirv.arm.tensor<1x1x278x55xi8> + %4 = spirv.Tosa.Resize %0, %arg0, %1, %2, %3 : (i32, !spirv.arm.tensor<1x1x31x55xi8>, !spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>) -> !spirv.arm.tensor<1x1x278x55xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x1x278x55xi8> + spirv.ARM.GraphOutputs %4 : !spirv.arm.tensor<1x1x278x55xi8> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Resize - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @resize_fp(%arg0: !spirv.arm.tensor<1x48x33x63xf32>) -> (!spirv.arm.tensor<1x753x297x63xf32>) { + %0 = spirv.Constant 2 : i32 + %1 = spirv.Constant dense<[16, 1, 9, 1]> : !spirv.arm.tensor<4xi32> + %2 = spirv.Constant dense<0> : !spirv.arm.tensor<2xi32> + %3 = spirv.Constant dense<[0, 8]> : !spirv.arm.tensor<2xi32> // CHECK: {{%.*}} = spirv.Tosa.Resize {{%.*}}, %arg0, {{%.*}}, {{%.*}}, {{%.*}} : (i32, !spirv.arm.tensor<1x48x33x63xf32>, !spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>) -> !spirv.arm.tensor<1x753x297x63xf32> + %4 = spirv.Tosa.Resize %0, %arg0, %1, %2, %3 : (i32, !spirv.arm.tensor<1x48x33x63xf32>, !spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>) -> !spirv.arm.tensor<1x753x297x63xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x753x297x63xf32> + spirv.ARM.GraphOutputs %4 : !spirv.arm.tensor<1x753x297x63xf32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Cast - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @cast_int(%arg0: !spirv.arm.tensor<1x65538x1x2xi8>) -> (!spirv.arm.tensor<1x65538x1x2xi32>) { + // CHECK: {{%.*}} = spirv.Tosa.Cast %arg0 : (!spirv.arm.tensor<1x65538x1x2xi8>) -> !spirv.arm.tensor<1x65538x1x2xi32> + %0 = spirv.Tosa.Cast %arg0 : (!spirv.arm.tensor<1x65538x1x2xi8>) -> !spirv.arm.tensor<1x65538x1x2xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x65538x1x2xi32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<1x65538x1x2xi32> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Cast - PRO-FP +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @cast_fp(%arg0: !spirv.arm.tensor<11x5x14x4xf32>) -> (!spirv.arm.tensor<11x5x14x4xf16>) { + // CHECK: {{%.*}} = spirv.Tosa.Cast %arg0 : (!spirv.arm.tensor<11x5x14x4xf32>) -> !spirv.arm.tensor<11x5x14x4xf16> + %0 = spirv.Tosa.Cast %arg0 : (!spirv.arm.tensor<11x5x14x4xf32>) -> !spirv.arm.tensor<11x5x14x4xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<11x5x14x4xf16> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<11x5x14x4xf16> +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Rescale - PRO-INT +//===----------------------------------------------------------------------===// + +spirv.ARM.Graph @rescale_int(%arg0: !spirv.arm.tensor<17x29x19xi16>) -> (!spirv.arm.tensor<17x29x19xi16>) { + %0 = spirv.Constant true + %1 = spirv.Constant 3 : i32 + %2 = spirv.Constant false + %3 = spirv.Constant false + %4 = spirv.Constant true + %5 = spirv.Constant dense<1866149760> : !spirv.arm.tensor<1xi32> + %6 = spirv.Constant dense<31> : !spirv.arm.tensor<1xi8> + %7 = spirv.Constant dense<0> : !spirv.arm.tensor<1xi16> + %8 = spirv.Constant dense<0> : !spirv.arm.tensor<1xi16> // CHECK: {{%.*}} = spirv.Tosa.Rescale {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, %arg0, {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}} : (i1, i32, i1, i1, i1, !spirv.arm.tensor<17x29x19xi16>, !spirv.arm.tensor<1xi32>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi16>, !spirv.arm.tensor<1xi16>) -> !spirv.arm.tensor<17x29x19xi16> + %9 = spirv.Tosa.Rescale %0, %1, %2, %3, %4, %arg0, %5, %6, %7, %8 : (i1, i32, i1, i1, i1, !spirv.arm.tensor<17x29x19xi16>, !spirv.arm.tensor<1xi32>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi16>, !spirv.arm.tensor<1xi16>) -> !spirv.arm.tensor<17x29x19xi16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<17x29x19xi16> + spirv.ARM.GraphOutputs %9 : !spirv.arm.tensor<17x29x19xi16> +} diff --git a/mlir/test/Target/SPIRV/tosa-ops.mlir b/mlir/test/Target/SPIRV/tosa-ops.mlir new file mode 100644 index 0000000000000..69f7684944165 --- /dev/null +++ b/mlir/test/Target/SPIRV/tosa-ops.mlir @@ -0,0 +1,2074 @@ +// RUN: mlir-translate --no-implicit-module --split-input-file --verify-diagnostics --test-spirv-roundtrip %s | FileCheck %s +// RUN: %if spirv-tools %{ rm -rf %t %} +// RUN: %if spirv-tools %{ mkdir %t %} +// RUN: %if spirv-tools %{ mlir-translate --no-implicit-module --serialize-spirv --split-input-file --spirv-save-validation-files-with-prefix=%t/module %s %} +// RUN: %if spirv-tools %{ spirv-val %t %} + +//===----------------------------------------------------------------------===// +// spirv.TOSA.ArgMax - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @argmax_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @argmax_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @argmax_int, @argmax_int_arg_0, @argmax_int_res_0 + spirv.ARM.Graph @argmax_int(%arg0: !spirv.arm.tensor<3x28x17x17xi8>) -> (!spirv.arm.tensor<3x28x17xi32>) { + %0 = spirv.Constant 3 : i32 + %1 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.ArgMax {{%.*}}, {{%.*}}, %arg0 : (i32, i32, !spirv.arm.tensor<3x28x17x17xi8>) -> !spirv.arm.tensor<3x28x17xi32> + %2 = spirv.Tosa.ArgMax %0, %1, %arg0 : (i32, i32, !spirv.arm.tensor<3x28x17x17xi8>) -> !spirv.arm.tensor<3x28x17xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<3x28x17xi32> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<3x28x17xi32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.ArgMax - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @argmax_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @argmax_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @argmax_fp, @argmax_fp_arg_0, @argmax_fp_res_0 + spirv.ARM.Graph @argmax_fp(%arg0: !spirv.arm.tensor<2x2x7x14xf32>) -> (!spirv.arm.tensor<2x2x14xi32>) { + %0 = spirv.Constant 2 : i32 + %1 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.ArgMax {{%.*}}, {{%.*}}, %arg0 : (i32, i32, !spirv.arm.tensor<2x2x7x14xf32>) -> !spirv.arm.tensor<2x2x14xi32> + %2 = spirv.Tosa.ArgMax %0, %1, %arg0 : (i32, i32, !spirv.arm.tensor<2x2x7x14xf32>) -> !spirv.arm.tensor<2x2x14xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<2x2x14xi32> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<2x2x14xi32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.AvgPool2D - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @avgpool2d_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @avgpool2d_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @avgpool2d_int, @avgpool2d_int_arg_0, @avgpool2d_int_res_0 + spirv.ARM.Graph @avgpool2d_int(%arg0: !spirv.arm.tensor<1x3x65537x1xi8>) -> (!spirv.arm.tensor<1x2x32768x1xi8>) { + %0 = spirv.Constant dense<3> : !spirv.arm.tensor<2xi32> + %1 = spirv.Constant dense<[1, 2]> : !spirv.arm.tensor<2xi32> + %2 = spirv.Constant dense<[0, 1, 0, 0]> : !spirv.arm.tensor<4xi32> + %3 = spirv.Constant 1 : i32 + %4 = spirv.Constant dense<125> : !spirv.arm.tensor<1xi8> + %5 = spirv.Constant dense<-90> : !spirv.arm.tensor<1xi8> // CHECK: {{%.*}} = spirv.Tosa.AvgPool2D {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, %arg0, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<4xi32>, i32, !spirv.arm.tensor<1x3x65537x1xi8>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<1x2x32768x1xi8> + %6 = spirv.Tosa.AvgPool2D %0, %1, %2, %3, %arg0, %4, %5 : (!spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<4xi32>, i32, !spirv.arm.tensor<1x3x65537x1xi8>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<1x2x32768x1xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x2x32768x1xi8> + spirv.ARM.GraphOutputs %6 : !spirv.arm.tensor<1x2x32768x1xi8> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.AvgPool2D - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @avgpool2d_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @avgpool2d_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @avgpool2d_fp, @avgpool2d_fp_arg_0, @avgpool2d_fp_res_0 + spirv.ARM.Graph @avgpool2d_fp(%arg0: !spirv.arm.tensor<1x2x65533x2xf32>) -> (!spirv.arm.tensor<1x2x65532x2xf32>) { + %0 = spirv.Constant dense<2> : !spirv.arm.tensor<2xi32> + %1 = spirv.Constant dense<1> : !spirv.arm.tensor<2xi32> + %2 = spirv.Constant dense<[1, 0, 0, 0]> : !spirv.arm.tensor<4xi32> + %3 = spirv.Constant 3 : i32 + %4 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf32> + %5 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf32> // CHECK: {{%.*}} = spirv.Tosa.AvgPool2D {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, %arg0, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<4xi32>, i32, !spirv.arm.tensor<1x2x65533x2xf32>, !spirv.arm.tensor<1xf32>, !spirv.arm.tensor<1xf32>) -> !spirv.arm.tensor<1x2x65532x2xf32> + %6 = spirv.Tosa.AvgPool2D %0, %1, %2, %3, %arg0, %4, %5 : (!spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<4xi32>, i32, !spirv.arm.tensor<1x2x65533x2xf32>, !spirv.arm.tensor<1xf32>, !spirv.arm.tensor<1xf32>) -> !spirv.arm.tensor<1x2x65532x2xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x2x65532x2xf32> + spirv.ARM.GraphOutputs %6 : !spirv.arm.tensor<1x2x65532x2xf32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Conv2D - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @conv2d_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @conv2d_int_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @conv2d_int_arg_2 bind(0, 2) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @conv2d_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @conv2d_int, @conv2d_int_arg_0, @conv2d_int_arg_1, @conv2d_int_arg_2, @conv2d_int_res_0 + spirv.ARM.Graph @conv2d_int(%arg0: !spirv.arm.tensor<1x65535x3x1xi8>, %arg1: !spirv.arm.tensor<7x1x1x1xi8>, %arg2: !spirv.arm.tensor<1xi32>) -> (!spirv.arm.tensor<1x65536x2x7xi32>) { + %0 = spirv.Constant dense<[1, 0, 0, 0]> : !spirv.arm.tensor<4xi32> + %1 = spirv.Constant dense<[1, 2]> : !spirv.arm.tensor<2xi32> + %2 = spirv.Constant dense<[7, 1]> : !spirv.arm.tensor<2xi32> + %3 = spirv.Constant 1 : i32 + %4 = spirv.Constant false + %5 = spirv.Constant dense<35> : !spirv.arm.tensor<1xi8> + %6 = spirv.Constant dense<57> : !spirv.arm.tensor<1xi8> // CHECK: {{%.*}} = spirv.Tosa.Conv2D {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, %arg0, %arg1, %arg2, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, i32, i1, !spirv.arm.tensor<1x65535x3x1xi8>, !spirv.arm.tensor<7x1x1x1xi8>, !spirv.arm.tensor<1xi32>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<1x65536x2x7xi32> + %7 = spirv.Tosa.Conv2D %0, %1, %2, %3, %4, %arg0, %arg1, %arg2, %5, %6 : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, i32, i1, !spirv.arm.tensor<1x65535x3x1xi8>, !spirv.arm.tensor<7x1x1x1xi8>, !spirv.arm.tensor<1xi32>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<1x65536x2x7xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x65536x2x7xi32> + spirv.ARM.GraphOutputs %7 : !spirv.arm.tensor<1x65536x2x7xi32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Conv2D - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @conv2d_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @conv2d_fp_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @conv2d_fp_arg_2 bind(0, 2) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @conv2d_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @conv2d_fp, @conv2d_fp_arg_0, @conv2d_fp_arg_1, @conv2d_fp_arg_2, @conv2d_fp_res_0 + spirv.ARM.Graph @conv2d_fp(%arg0: !spirv.arm.tensor<1x34x18x27xf16>, %arg1: !spirv.arm.tensor<11x1x1x27xf16>, %arg2: !spirv.arm.tensor<11xf16>) -> (!spirv.arm.tensor<1x34x18x11xf16>) { + %0 = spirv.Constant dense<0> : !spirv.arm.tensor<4xi32> + %1 = spirv.Constant dense<1> : !spirv.arm.tensor<2xi32> + %2 = spirv.Constant dense<1> : !spirv.arm.tensor<2xi32> + %3 = spirv.Constant 2 : i32 + %4 = spirv.Constant true + %5 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf16> + %6 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf16> // CHECK: {{%.*}} = spirv.Tosa.Conv2D {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, %arg0, %arg1, %arg2, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, i32, i1, !spirv.arm.tensor<1x34x18x27xf16>, !spirv.arm.tensor<11x1x1x27xf16>, !spirv.arm.tensor<11xf16>, !spirv.arm.tensor<1xf16>, !spirv.arm.tensor<1xf16>) -> !spirv.arm.tensor<1x34x18x11xf16> + %7 = spirv.Tosa.Conv2D %0, %1, %2, %3, %4, %arg0, %arg1, %arg2, %5, %6 : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, i32, i1, !spirv.arm.tensor<1x34x18x27xf16>, !spirv.arm.tensor<11x1x1x27xf16>, !spirv.arm.tensor<11xf16>, !spirv.arm.tensor<1xf16>, !spirv.arm.tensor<1xf16>) -> !spirv.arm.tensor<1x34x18x11xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x34x18x11xf16> + spirv.ARM.GraphOutputs %7 : !spirv.arm.tensor<1x34x18x11xf16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Conv3D - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @conv3d_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @conv3d_int_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @conv3d_int_arg_2 bind(0, 2) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @conv3d_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @conv3d_int, @conv3d_int_arg_0, @conv3d_int_arg_1, @conv3d_int_arg_2, @conv3d_int_res_0 + spirv.ARM.Graph @conv3d_int(%arg0: !spirv.arm.tensor<1x9x21x14x1xi8>, %arg1: !spirv.arm.tensor<2x1x2x1x1xi8>, %arg2: !spirv.arm.tensor<1xi32>) -> (!spirv.arm.tensor<1x9x20x14x2xi32>) { + %0 = spirv.Constant dense<0> : !spirv.arm.tensor<6xi32> + %1 = spirv.Constant dense<1> : !spirv.arm.tensor<3xi32> + %2 = spirv.Constant dense<1> : !spirv.arm.tensor<3xi32> + %3 = spirv.Constant 1 : i32 + %4 = spirv.Constant false + %5 = spirv.Constant dense<123> : !spirv.arm.tensor<1xi8> + %6 = spirv.Constant dense<121> : !spirv.arm.tensor<1xi8> // CHECK: {{%.*}} = spirv.Tosa.Conv3D {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, %arg0, %arg1, %arg2, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<6xi32>, !spirv.arm.tensor<3xi32>, !spirv.arm.tensor<3xi32>, i32, i1, !spirv.arm.tensor<1x9x21x14x1xi8>, !spirv.arm.tensor<2x1x2x1x1xi8>, !spirv.arm.tensor<1xi32>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<1x9x20x14x2xi32> + %7 = spirv.Tosa.Conv3D %0, %1, %2, %3, %4, %arg0, %arg1, %arg2, %5, %6 : (!spirv.arm.tensor<6xi32>, !spirv.arm.tensor<3xi32>, !spirv.arm.tensor<3xi32>, i32, i1, !spirv.arm.tensor<1x9x21x14x1xi8>, !spirv.arm.tensor<2x1x2x1x1xi8>, !spirv.arm.tensor<1xi32>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<1x9x20x14x2xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x9x20x14x2xi32> + spirv.ARM.GraphOutputs %7 : !spirv.arm.tensor<1x9x20x14x2xi32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Conv3D - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @conv3d_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @conv3d_fp_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @conv3d_fp_arg_2 bind(0, 2) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @conv3d_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @conv3d_fp, @conv3d_fp_arg_0, @conv3d_fp_arg_1, @conv3d_fp_arg_2, @conv3d_fp_res_0 + spirv.ARM.Graph @conv3d_fp(%arg0: !spirv.arm.tensor<1x2x65539x1x2xf32>, %arg1: !spirv.arm.tensor<1x1x1x1x2xf32>, %arg2: !spirv.arm.tensor<1xf32>) -> (!spirv.arm.tensor<1x3x65540x2x1xf32>) { + %0 = spirv.Constant dense<[0, 1, 1, 0, 0, 1]> : !spirv.arm.tensor<6xi32> + %1 = spirv.Constant dense<1> : !spirv.arm.tensor<3xi32> + %2 = spirv.Constant dense<[1, 1, 7]> : !spirv.arm.tensor<3xi32> + %3 = spirv.Constant 3 : i32 + %4 = spirv.Constant false + %5 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf32> + %6 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf32> // CHECK: {{%.*}} = spirv.Tosa.Conv3D {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, %arg0, %arg1, %arg2, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<6xi32>, !spirv.arm.tensor<3xi32>, !spirv.arm.tensor<3xi32>, i32, i1, !spirv.arm.tensor<1x2x65539x1x2xf32>, !spirv.arm.tensor<1x1x1x1x2xf32>, !spirv.arm.tensor<1xf32>, !spirv.arm.tensor<1xf32>, !spirv.arm.tensor<1xf32>) -> !spirv.arm.tensor<1x3x65540x2x1xf32> + %7 = spirv.Tosa.Conv3D %0, %1, %2, %3, %4, %arg0, %arg1, %arg2, %5, %6 : (!spirv.arm.tensor<6xi32>, !spirv.arm.tensor<3xi32>, !spirv.arm.tensor<3xi32>, i32, i1, !spirv.arm.tensor<1x2x65539x1x2xf32>, !spirv.arm.tensor<1x1x1x1x2xf32>, !spirv.arm.tensor<1xf32>, !spirv.arm.tensor<1xf32>, !spirv.arm.tensor<1xf32>) -> !spirv.arm.tensor<1x3x65540x2x1xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x3x65540x2x1xf32> + spirv.ARM.GraphOutputs %7 : !spirv.arm.tensor<1x3x65540x2x1xf32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.DepthwiseConv2D - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @depthwiseconv2d_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @depthwiseconv2d_int_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @depthwiseconv2d_int_arg_2 bind(0, 2) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @depthwiseconv2d_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @depthwiseconv2d_int, @depthwiseconv2d_int_arg_0, @depthwiseconv2d_int_arg_1, @depthwiseconv2d_int_arg_2, @depthwiseconv2d_int_res_0 + spirv.ARM.Graph @depthwiseconv2d_int(%arg0: !spirv.arm.tensor<1x4x65537x1xi8>, %arg1: !spirv.arm.tensor<1x3x1x4xi8>, %arg2: !spirv.arm.tensor<4xi32>) -> (!spirv.arm.tensor<1x4x32762x4xi32>) { + %0 = spirv.Constant dense<0> : !spirv.arm.tensor<4xi32> + %1 = spirv.Constant dense<[1, 2]> : !spirv.arm.tensor<2xi32> + %2 = spirv.Constant dense<7> : !spirv.arm.tensor<2xi32> + %3 = spirv.Constant 1 : i32 + %4 = spirv.Constant false + %5 = spirv.Constant dense<58> : !spirv.arm.tensor<1xi8> + %6 = spirv.Constant dense<-106> : !spirv.arm.tensor<1xi8> // CHECK: {{%.*}} = spirv.Tosa.DepthwiseConv2D {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, %arg0, %arg1, %arg2, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, i32, i1, !spirv.arm.tensor<1x4x65537x1xi8>, !spirv.arm.tensor<1x3x1x4xi8>, !spirv.arm.tensor<4xi32>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<1x4x32762x4xi32> + %7 = spirv.Tosa.DepthwiseConv2D %0, %1, %2, %3, %4, %arg0, %arg1, %arg2, %5, %6 : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, i32, i1, !spirv.arm.tensor<1x4x65537x1xi8>, !spirv.arm.tensor<1x3x1x4xi8>, !spirv.arm.tensor<4xi32>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<1x4x32762x4xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x4x32762x4xi32> + spirv.ARM.GraphOutputs %7 : !spirv.arm.tensor<1x4x32762x4xi32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.DepthwiseConv2D - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @depthwiseconv2d_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @depthwiseconv2d_fp_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @depthwiseconv2d_fp_arg_2 bind(0, 2) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @depthwiseconv2d_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @depthwiseconv2d_fp, @depthwiseconv2d_fp_arg_0, @depthwiseconv2d_fp_arg_1, @depthwiseconv2d_fp_arg_2, @depthwiseconv2d_fp_res_0 + spirv.ARM.Graph @depthwiseconv2d_fp(%arg0: !spirv.arm.tensor<1x65540x1x3xf32>, %arg1: !spirv.arm.tensor<1x1x3x1xf32>, %arg2: !spirv.arm.tensor<1xf32>) -> (!spirv.arm.tensor<1x65541x2x3xf32>) { + %0 = spirv.Constant dense<[0, 1, 1, 1]> : !spirv.arm.tensor<4xi32> + %1 = spirv.Constant dense<[1, 2]> : !spirv.arm.tensor<2xi32> + %2 = spirv.Constant dense<[1, 7]> : !spirv.arm.tensor<2xi32> + %3 = spirv.Constant 3 : i32 + %4 = spirv.Constant true + %5 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf32> + %6 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf32> // CHECK: {{%.*}} = spirv.Tosa.DepthwiseConv2D {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, %arg0, %arg1, %arg2, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, i32, i1, !spirv.arm.tensor<1x65540x1x3xf32>, !spirv.arm.tensor<1x1x3x1xf32>, !spirv.arm.tensor<1xf32>, !spirv.arm.tensor<1xf32>, !spirv.arm.tensor<1xf32>) -> !spirv.arm.tensor<1x65541x2x3xf32> + %7 = spirv.Tosa.DepthwiseConv2D %0, %1, %2, %3, %4, %arg0, %arg1, %arg2, %5, %6 : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, i32, i1, !spirv.arm.tensor<1x65540x1x3xf32>, !spirv.arm.tensor<1x1x3x1xf32>, !spirv.arm.tensor<1xf32>, !spirv.arm.tensor<1xf32>, !spirv.arm.tensor<1xf32>) -> !spirv.arm.tensor<1x65541x2x3xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x65541x2x3xf32> + spirv.ARM.GraphOutputs %7 : !spirv.arm.tensor<1x65541x2x3xf32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.FFT2D - EXT-FFT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @fft2d_fft_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @fft2d_fft_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @fft2d_fft_res_0 bind(0, 2) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @fft2d_fft_res_1 bind(0, 3) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @fft2d_fft, @fft2d_fft_arg_0, @fft2d_fft_arg_1, @fft2d_fft_res_0, @fft2d_fft_res_1 + spirv.ARM.Graph @fft2d_fft(%arg0: !spirv.arm.tensor<1x32x32xf32>, %arg1: !spirv.arm.tensor<1x32x32xf32>) -> (!spirv.arm.tensor<1x32x32xf32>, !spirv.arm.tensor<1x32x32xf32>) { + %0 = spirv.Constant true + %1 = spirv.Constant false + // CHECK: {{%.*}} = spirv.Tosa.FFT2D {{%.*}}, {{%.*}}, %arg0, %arg1 : (i1, i1, !spirv.arm.tensor<1x32x32xf32>, !spirv.arm.tensor<1x32x32xf32>) -> !spirv.struct<(!spirv.arm.tensor<1x32x32xf32>, !spirv.arm.tensor<1x32x32xf32>)> + %out = spirv.Tosa.FFT2D %0, %1, %arg0, %arg1 : (i1, i1, !spirv.arm.tensor<1x32x32xf32>, !spirv.arm.tensor<1x32x32xf32>) -> !spirv.struct<(!spirv.arm.tensor<1x32x32xf32>, !spirv.arm.tensor<1x32x32xf32>)> + // CHECK: {{%.*}} = spirv.CompositeExtract {{%.*}}[0 : i32] : !spirv.struct<(!spirv.arm.tensor<1x32x32xf32>, !spirv.arm.tensor<1x32x32xf32>)> + %out0 = spirv.CompositeExtract %out[0 : i32] : !spirv.struct<(!spirv.arm.tensor<1x32x32xf32>, !spirv.arm.tensor<1x32x32xf32>)> + // CHECK: {{%.*}} = spirv.CompositeExtract {{%.*}}[1 : i32] : !spirv.struct<(!spirv.arm.tensor<1x32x32xf32>, !spirv.arm.tensor<1x32x32xf32>)> + %out1 = spirv.CompositeExtract %out[1 : i32] : !spirv.struct<(!spirv.arm.tensor<1x32x32xf32>, !spirv.arm.tensor<1x32x32xf32>)> + // CHECK: spirv.ARM.GraphOutputs {{%.*}}, {{%.*}} : !spirv.arm.tensor<1x32x32xf32>, !spirv.arm.tensor<1x32x32xf32> + spirv.ARM.GraphOutputs %out0, %out1 : !spirv.arm.tensor<1x32x32xf32>, !spirv.arm.tensor<1x32x32xf32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.MatMul - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @matmul_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @matmul_int_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @matmul_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @matmul_int, @matmul_int_arg_0, @matmul_int_arg_1, @matmul_int_res_0 + spirv.ARM.Graph @matmul_int(%arg0: !spirv.arm.tensor<8x2x3xi8>, %arg1: !spirv.arm.tensor<8x3x8xi8>) -> (!spirv.arm.tensor<8x2x8xi32>) { + %0 = spirv.Constant dense<0> : !spirv.arm.tensor<1xi8> + %1 = spirv.Constant dense<0> : !spirv.arm.tensor<1xi8> // CHECK: {{%.*}} = spirv.Tosa.MatMul %arg0, %arg1, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<8x2x3xi8>, !spirv.arm.tensor<8x3x8xi8>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<8x2x8xi32> + %2 = spirv.Tosa.MatMul %arg0, %arg1, %0, %1 : (!spirv.arm.tensor<8x2x3xi8>, !spirv.arm.tensor<8x3x8xi8>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<8x2x8xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<8x2x8xi32> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<8x2x8xi32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.MatMul - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @matmul_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @matmul_fp_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @matmul_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @matmul_fp, @matmul_fp_arg_0, @matmul_fp_arg_1, @matmul_fp_res_0 + spirv.ARM.Graph @matmul_fp(%arg0: !spirv.arm.tensor<15x39x50xf16>, %arg1: !spirv.arm.tensor<15x50x24xf16>) -> (!spirv.arm.tensor<15x39x24xf16>) { + %0 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf16> + %1 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf16> // CHECK: {{%.*}} = spirv.Tosa.MatMul %arg0, %arg1, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<15x39x50xf16>, !spirv.arm.tensor<15x50x24xf16>, !spirv.arm.tensor<1xf16>, !spirv.arm.tensor<1xf16>) -> !spirv.arm.tensor<15x39x24xf16> + %2 = spirv.Tosa.MatMul %arg0, %arg1, %0, %1 : (!spirv.arm.tensor<15x39x50xf16>, !spirv.arm.tensor<15x50x24xf16>, !spirv.arm.tensor<1xf16>, !spirv.arm.tensor<1xf16>) -> !spirv.arm.tensor<15x39x24xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<15x39x24xf16> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<15x39x24xf16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.MaxPool2D - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @maxpool2d_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @maxpool2d_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @maxpool2d_int, @maxpool2d_int_arg_0, @maxpool2d_int_res_0 + spirv.ARM.Graph @maxpool2d_int(%arg0: !spirv.arm.tensor<1x3x65537x1xi8>) -> (!spirv.arm.tensor<1x2x32769x1xi8>) { + %0 = spirv.Constant dense<[3, 2]> : !spirv.arm.tensor<2xi32> + %1 = spirv.Constant dense<[1, 2]> : !spirv.arm.tensor<2xi32> + %2 = spirv.Constant dense<[1, 0, 0, 1]> : !spirv.arm.tensor<4xi32> + %3 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.MaxPool2D {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, %arg0 : (!spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<4xi32>, i32, !spirv.arm.tensor<1x3x65537x1xi8>) -> !spirv.arm.tensor<1x2x32769x1xi8> + %4 = spirv.Tosa.MaxPool2D %0, %1, %2, %3, %arg0 : (!spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<4xi32>, i32, !spirv.arm.tensor<1x3x65537x1xi8>) -> !spirv.arm.tensor<1x2x32769x1xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x2x32769x1xi8> + spirv.ARM.GraphOutputs %4 : !spirv.arm.tensor<1x2x32769x1xi8> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.MaxPool2D - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @maxpool2d_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @maxpool2d_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @maxpool2d_fp, @maxpool2d_fp_arg_0, @maxpool2d_fp_res_0 + spirv.ARM.Graph @maxpool2d_fp(%arg0: !spirv.arm.tensor<1x6x65536x1xf32>) -> (!spirv.arm.tensor<1x3x32769x1xf32>) { + %0 = spirv.Constant dense<[3, 2]> : !spirv.arm.tensor<2xi32> + %1 = spirv.Constant dense<2> : !spirv.arm.tensor<2xi32> + %2 = spirv.Constant dense<[1, 0, 1, 1]> : !spirv.arm.tensor<4xi32> + %3 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.MaxPool2D {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, %arg0 : (!spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<4xi32>, i32, !spirv.arm.tensor<1x6x65536x1xf32>) -> !spirv.arm.tensor<1x3x32769x1xf32> + %4 = spirv.Tosa.MaxPool2D %0, %1, %2, %3, %arg0 : (!spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<4xi32>, i32, !spirv.arm.tensor<1x6x65536x1xf32>) -> !spirv.arm.tensor<1x3x32769x1xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x3x32769x1xf32> + spirv.ARM.GraphOutputs %4 : !spirv.arm.tensor<1x3x32769x1xf32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.RFFT2D - EXT-FFT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @rfft2d_fft_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @rfft2d_fft_res_0 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @rfft2d_fft_res_1 bind(0, 2) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @rfft2d_fft, @rfft2d_fft_arg_0, @rfft2d_fft_res_0, @rfft2d_fft_res_1 + spirv.ARM.Graph @rfft2d_fft(%arg0: !spirv.arm.tensor<1x32x32xf32>) -> (!spirv.arm.tensor<1x32x17xf32>, !spirv.arm.tensor<1x32x17xf32>) { + %0 = spirv.Constant false + // CHECK: {{%.*}} = spirv.Tosa.RFFT2D {{%.*}}, %arg0 : (i1, !spirv.arm.tensor<1x32x32xf32>) -> !spirv.struct<(!spirv.arm.tensor<1x32x17xf32>, !spirv.arm.tensor<1x32x17xf32>)> + %out = spirv.Tosa.RFFT2D %0, %arg0 : (i1, !spirv.arm.tensor<1x32x32xf32>) -> !spirv.struct<(!spirv.arm.tensor<1x32x17xf32>, !spirv.arm.tensor<1x32x17xf32>)> + // CHECK: {{%.*}} = spirv.CompositeExtract {{%.*}}[0 : i32] : !spirv.struct<(!spirv.arm.tensor<1x32x17xf32>, !spirv.arm.tensor<1x32x17xf32>)> + %out0 = spirv.CompositeExtract %out[0 : i32] : !spirv.struct<(!spirv.arm.tensor<1x32x17xf32>, !spirv.arm.tensor<1x32x17xf32>)> + // CHECK: {{%.*}} = spirv.CompositeExtract {{%.*}}[1 : i32] : !spirv.struct<(!spirv.arm.tensor<1x32x17xf32>, !spirv.arm.tensor<1x32x17xf32>)> + %out1 = spirv.CompositeExtract %out[1 : i32] : !spirv.struct<(!spirv.arm.tensor<1x32x17xf32>, !spirv.arm.tensor<1x32x17xf32>)> + // CHECK: spirv.ARM.GraphOutputs {{%.*}}, {{%.*}} : !spirv.arm.tensor<1x32x17xf32>, !spirv.arm.tensor<1x32x17xf32> + spirv.ARM.GraphOutputs %out0, %out1 : !spirv.arm.tensor<1x32x17xf32>, !spirv.arm.tensor<1x32x17xf32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.TransposeConv2D - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @transposeconv2d_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @transposeconv2d_int_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @transposeconv2d_int_arg_2 bind(0, 2) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @transposeconv2d_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @transposeconv2d_int, @transposeconv2d_int_arg_0, @transposeconv2d_int_arg_1, @transposeconv2d_int_arg_2, @transposeconv2d_int_res_0 + spirv.ARM.Graph @transposeconv2d_int(%arg0: !spirv.arm.tensor<1x13x33x3xi16>, %arg1: !spirv.arm.tensor<11x1x3x3xi8>, %arg2: !spirv.arm.tensor<1xi64>) -> (!spirv.arm.tensor<1x13x35x11xi64>) { + %0 = spirv.Constant dense<0> : !spirv.arm.tensor<4xi32> + %1 = spirv.Constant dense<1> : !spirv.arm.tensor<2xi32> + %2 = spirv.Constant 4 : i32 + %3 = spirv.Constant false + %4 = spirv.Constant dense<0> : !spirv.arm.tensor<1xi16> + %5 = spirv.Constant dense<88> : !spirv.arm.tensor<1xi8> // CHECK: {{%.*}} = spirv.Tosa.TransposeConv2D {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, %arg0, %arg1, %arg2, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, i32, i1, !spirv.arm.tensor<1x13x33x3xi16>, !spirv.arm.tensor<11x1x3x3xi8>, !spirv.arm.tensor<1xi64>, !spirv.arm.tensor<1xi16>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<1x13x35x11xi64> + %6 = spirv.Tosa.TransposeConv2D %0, %1, %2, %3, %arg0, %arg1, %arg2, %4, %5 : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, i32, i1, !spirv.arm.tensor<1x13x33x3xi16>, !spirv.arm.tensor<11x1x3x3xi8>, !spirv.arm.tensor<1xi64>, !spirv.arm.tensor<1xi16>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<1x13x35x11xi64> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x13x35x11xi64> + spirv.ARM.GraphOutputs %6 : !spirv.arm.tensor<1x13x35x11xi64> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.TransposeConv2D - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @transposeconv2d_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @transposeconv2d_fp_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @transposeconv2d_fp_arg_2 bind(0, 2) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @transposeconv2d_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @transposeconv2d_fp, @transposeconv2d_fp_arg_0, @transposeconv2d_fp_arg_1, @transposeconv2d_fp_arg_2, @transposeconv2d_fp_res_0 + spirv.ARM.Graph @transposeconv2d_fp(%arg0: !spirv.arm.tensor<10x24x9x13xf16>, %arg1: !spirv.arm.tensor<14x1x1x13xf16>, %arg2: !spirv.arm.tensor<14xf16>) -> (!spirv.arm.tensor<10x25x65x14xf16>) { + %0 = spirv.Constant dense<[0, 1, 0, 0]> : !spirv.arm.tensor<4xi32> + %1 = spirv.Constant dense<[1, 8]> : !spirv.arm.tensor<2xi32> + %2 = spirv.Constant 2 : i32 + %3 = spirv.Constant true + %4 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf16> + %5 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf16> // CHECK: {{%.*}} = spirv.Tosa.TransposeConv2D {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, %arg0, %arg1, %arg2, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, i32, i1, !spirv.arm.tensor<10x24x9x13xf16>, !spirv.arm.tensor<14x1x1x13xf16>, !spirv.arm.tensor<14xf16>, !spirv.arm.tensor<1xf16>, !spirv.arm.tensor<1xf16>) -> !spirv.arm.tensor<10x25x65x14xf16> + %6 = spirv.Tosa.TransposeConv2D %0, %1, %2, %3, %arg0, %arg1, %arg2, %4, %5 : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, i32, i1, !spirv.arm.tensor<10x24x9x13xf16>, !spirv.arm.tensor<14x1x1x13xf16>, !spirv.arm.tensor<14xf16>, !spirv.arm.tensor<1xf16>, !spirv.arm.tensor<1xf16>) -> !spirv.arm.tensor<10x25x65x14xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<10x25x65x14xf16> + spirv.ARM.GraphOutputs %6 : !spirv.arm.tensor<10x25x65x14xf16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Clamp - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @clamp_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @clamp_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @clamp_int, @clamp_int_arg_0, @clamp_int_res_0 + spirv.ARM.Graph @clamp_int(%arg0: !spirv.arm.tensor<27x44x55xi8>) -> (!spirv.arm.tensor<27x44x55xi8>) { + %0 = spirv.Constant -102 : i8 + %1 = spirv.Constant -100 : i8 + %2 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.Clamp {{%.*}}, {{%.*}}, {{%.*}}, %arg0 : (i8, i8, i32, !spirv.arm.tensor<27x44x55xi8>) -> !spirv.arm.tensor<27x44x55xi8> + %3 = spirv.Tosa.Clamp %0, %1, %2, %arg0 : (i8, i8, i32, !spirv.arm.tensor<27x44x55xi8>) -> !spirv.arm.tensor<27x44x55xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<27x44x55xi8> + spirv.ARM.GraphOutputs %3 : !spirv.arm.tensor<27x44x55xi8> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Clamp - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @clamp_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @clamp_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @clamp_fp, @clamp_fp_arg_0, @clamp_fp_res_0 + spirv.ARM.Graph @clamp_fp(%arg0: !spirv.arm.tensor<18x5x17x6xf32>) -> (!spirv.arm.tensor<18x5x17x6xf32>) { + %0 = spirv.Constant -1.193394e+38 : f32 + %1 = spirv.Constant 2.3825594e+38 : f32 + %2 = spirv.Constant 2 : i32 // CHECK: {{%.*}} = spirv.Tosa.Clamp {{%.*}}, {{%.*}}, {{%.*}}, %arg0 : (f32, f32, i32, !spirv.arm.tensor<18x5x17x6xf32>) -> !spirv.arm.tensor<18x5x17x6xf32> + %3 = spirv.Tosa.Clamp %0, %1, %2, %arg0 : (f32, f32, i32, !spirv.arm.tensor<18x5x17x6xf32>) -> !spirv.arm.tensor<18x5x17x6xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<18x5x17x6xf32> + spirv.ARM.GraphOutputs %3 : !spirv.arm.tensor<18x5x17x6xf32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Erf - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @erf_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @erf_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @erf_fp, @erf_fp_arg_0, @erf_fp_res_0 + spirv.ARM.Graph @erf_fp(%arg0: !spirv.arm.tensor<47x38x51xf32>) -> (!spirv.arm.tensor<47x38x51xf32>) { + // CHECK: {{%.*}} = spirv.Tosa.Erf %arg0 : (!spirv.arm.tensor<47x38x51xf32>) -> !spirv.arm.tensor<47x38x51xf32> + %0 = spirv.Tosa.Erf %arg0 : (!spirv.arm.tensor<47x38x51xf32>) -> !spirv.arm.tensor<47x38x51xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<47x38x51xf32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<47x38x51xf32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Sigmoid - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @sigmoid_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @sigmoid_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @sigmoid_fp, @sigmoid_fp_arg_0, @sigmoid_fp_res_0 + spirv.ARM.Graph @sigmoid_fp(%arg0: !spirv.arm.tensor<28x43x45xf32>) -> (!spirv.arm.tensor<28x43x45xf32>) { + // CHECK: {{%.*}} = spirv.Tosa.Sigmoid %arg0 : (!spirv.arm.tensor<28x43x45xf32>) -> !spirv.arm.tensor<28x43x45xf32> + %0 = spirv.Tosa.Sigmoid %arg0 : (!spirv.arm.tensor<28x43x45xf32>) -> !spirv.arm.tensor<28x43x45xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<28x43x45xf32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<28x43x45xf32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Tanh - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @tanh_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @tanh_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @tanh_fp, @tanh_fp_arg_0, @tanh_fp_res_0 + spirv.ARM.Graph @tanh_fp(%arg0: !spirv.arm.tensor<46x50x36xf16>) -> (!spirv.arm.tensor<46x50x36xf16>) { + // CHECK: {{%.*}} = spirv.Tosa.Tanh %arg0 : (!spirv.arm.tensor<46x50x36xf16>) -> !spirv.arm.tensor<46x50x36xf16> + %0 = spirv.Tosa.Tanh %arg0 : (!spirv.arm.tensor<46x50x36xf16>) -> !spirv.arm.tensor<46x50x36xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<46x50x36xf16> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<46x50x36xf16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Add - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @add_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @add_int_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @add_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @add_int, @add_int_arg_0, @add_int_arg_1, @add_int_res_0 + spirv.ARM.Graph @add_int(%arg0: !spirv.arm.tensor<4x7x3x10xi32>, %arg1: !spirv.arm.tensor<4x7x3x1xi32>) -> (!spirv.arm.tensor<4x7x3x10xi32>) { + // CHECK: {{%.*}} = spirv.Tosa.Add %arg0, %arg1 : (!spirv.arm.tensor<4x7x3x10xi32>, !spirv.arm.tensor<4x7x3x1xi32>) -> !spirv.arm.tensor<4x7x3x10xi32> + %0 = spirv.Tosa.Add %arg0, %arg1 : (!spirv.arm.tensor<4x7x3x10xi32>, !spirv.arm.tensor<4x7x3x1xi32>) -> !spirv.arm.tensor<4x7x3x10xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<4x7x3x10xi32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<4x7x3x10xi32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Add - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @add_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @add_fp_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @add_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @add_fp, @add_fp_arg_0, @add_fp_arg_1, @add_fp_res_0 + spirv.ARM.Graph @add_fp(%arg0: !spirv.arm.tensor<26x37x18xf16>, %arg1: !spirv.arm.tensor<1x37x18xf16>) -> (!spirv.arm.tensor<26x37x18xf16>) { + // CHECK: {{%.*}} = spirv.Tosa.Add %arg0, %arg1 : (!spirv.arm.tensor<26x37x18xf16>, !spirv.arm.tensor<1x37x18xf16>) -> !spirv.arm.tensor<26x37x18xf16> + %0 = spirv.Tosa.Add %arg0, %arg1 : (!spirv.arm.tensor<26x37x18xf16>, !spirv.arm.tensor<1x37x18xf16>) -> !spirv.arm.tensor<26x37x18xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<26x37x18xf16> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<26x37x18xf16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.ArithmeticRightShift - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @arithmeticrightshift_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @arithmeticrightshift_int_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @arithmeticrightshift_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @arithmeticrightshift_int, @arithmeticrightshift_int_arg_0, @arithmeticrightshift_int_arg_1, @arithmeticrightshift_int_res_0 + spirv.ARM.Graph @arithmeticrightshift_int(%arg0: !spirv.arm.tensor<1x47x22xi16>, %arg1: !spirv.arm.tensor<49x47x22xi16>) -> (!spirv.arm.tensor<49x47x22xi16>) { + %0 = spirv.Constant true // CHECK: {{%.*}} = spirv.Tosa.ArithmeticRightShift {{%.*}}, %arg0, %arg1 : (i1, !spirv.arm.tensor<1x47x22xi16>, !spirv.arm.tensor<49x47x22xi16>) -> !spirv.arm.tensor<49x47x22xi16> + %1 = spirv.Tosa.ArithmeticRightShift %0, %arg0, %arg1 : (i1, !spirv.arm.tensor<1x47x22xi16>, !spirv.arm.tensor<49x47x22xi16>) -> !spirv.arm.tensor<49x47x22xi16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<49x47x22xi16> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<49x47x22xi16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.BitwiseAnd - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @bitwiseand_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @bitwiseand_int_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @bitwiseand_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @bitwiseand_int, @bitwiseand_int_arg_0, @bitwiseand_int_arg_1, @bitwiseand_int_res_0 + spirv.ARM.Graph @bitwiseand_int(%arg0: !spirv.arm.tensor<4x1x7x12xi16>, %arg1: !spirv.arm.tensor<4x13x7x12xi16>) -> (!spirv.arm.tensor<4x13x7x12xi16>) { + // CHECK: {{%.*}} = spirv.Tosa.BitwiseAnd %arg0, %arg1 : (!spirv.arm.tensor<4x1x7x12xi16>, !spirv.arm.tensor<4x13x7x12xi16>) -> !spirv.arm.tensor<4x13x7x12xi16> + %0 = spirv.Tosa.BitwiseAnd %arg0, %arg1 : (!spirv.arm.tensor<4x1x7x12xi16>, !spirv.arm.tensor<4x13x7x12xi16>) -> !spirv.arm.tensor<4x13x7x12xi16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<4x13x7x12xi16> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<4x13x7x12xi16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.BitwiseOr - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @bitwiseor_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @bitwiseor_int_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @bitwiseor_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @bitwiseor_int, @bitwiseor_int_arg_0, @bitwiseor_int_arg_1, @bitwiseor_int_res_0 + spirv.ARM.Graph @bitwiseor_int(%arg0: !spirv.arm.tensor<11x30x23xi32>, %arg1: !spirv.arm.tensor<1x30x23xi32>) -> (!spirv.arm.tensor<11x30x23xi32>) { + // CHECK: {{%.*}} = spirv.Tosa.BitwiseOr %arg0, %arg1 : (!spirv.arm.tensor<11x30x23xi32>, !spirv.arm.tensor<1x30x23xi32>) -> !spirv.arm.tensor<11x30x23xi32> + %0 = spirv.Tosa.BitwiseOr %arg0, %arg1 : (!spirv.arm.tensor<11x30x23xi32>, !spirv.arm.tensor<1x30x23xi32>) -> !spirv.arm.tensor<11x30x23xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<11x30x23xi32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<11x30x23xi32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.BitwiseXor - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @bitwisexor_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @bitwisexor_int_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @bitwisexor_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @bitwisexor_int, @bitwisexor_int_arg_0, @bitwisexor_int_arg_1, @bitwisexor_int_res_0 + spirv.ARM.Graph @bitwisexor_int(%arg0: !spirv.arm.tensor<4x8x13x9xi16>, %arg1: !spirv.arm.tensor<4x8x1x9xi16>) -> (!spirv.arm.tensor<4x8x13x9xi16>) { + // CHECK: {{%.*}} = spirv.Tosa.BitwiseXor %arg0, %arg1 : (!spirv.arm.tensor<4x8x13x9xi16>, !spirv.arm.tensor<4x8x1x9xi16>) -> !spirv.arm.tensor<4x8x13x9xi16> + %0 = spirv.Tosa.BitwiseXor %arg0, %arg1 : (!spirv.arm.tensor<4x8x13x9xi16>, !spirv.arm.tensor<4x8x1x9xi16>) -> !spirv.arm.tensor<4x8x13x9xi16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<4x8x13x9xi16> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<4x8x13x9xi16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.IntDiv - PRO-INT or PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @intdiv_any_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @intdiv_any_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @intdiv_any_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @intdiv_any, @intdiv_any_arg_0, @intdiv_any_arg_1, @intdiv_any_res_0 + spirv.ARM.Graph @intdiv_any(%arg0: !spirv.arm.tensor<1x65533x1xi32>, %arg1: !spirv.arm.tensor<2x65533x1xi32>) -> (!spirv.arm.tensor<2x65533x1xi32>) { + // CHECK: {{%.*}} = spirv.Tosa.IntDiv %arg0, %arg1 : (!spirv.arm.tensor<1x65533x1xi32>, !spirv.arm.tensor<2x65533x1xi32>) -> !spirv.arm.tensor<2x65533x1xi32> + %0 = spirv.Tosa.IntDiv %arg0, %arg1 : (!spirv.arm.tensor<1x65533x1xi32>, !spirv.arm.tensor<2x65533x1xi32>) -> !spirv.arm.tensor<2x65533x1xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<2x65533x1xi32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<2x65533x1xi32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.LogicalAnd - PRO-INT or PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @logicaland_any_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @logicaland_any_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @logicaland_any_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @logicaland_any, @logicaland_any_arg_0, @logicaland_any_arg_1, @logicaland_any_res_0 + spirv.ARM.Graph @logicaland_any(%arg0: !spirv.arm.tensor<2x1x7x11xi1>, %arg1: !spirv.arm.tensor<2x4x7x11xi1>) -> (!spirv.arm.tensor<2x4x7x11xi1>) { + // CHECK: {{%.*}} = spirv.Tosa.LogicalAnd %arg0, %arg1 : (!spirv.arm.tensor<2x1x7x11xi1>, !spirv.arm.tensor<2x4x7x11xi1>) -> !spirv.arm.tensor<2x4x7x11xi1> + %0 = spirv.Tosa.LogicalAnd %arg0, %arg1 : (!spirv.arm.tensor<2x1x7x11xi1>, !spirv.arm.tensor<2x4x7x11xi1>) -> !spirv.arm.tensor<2x4x7x11xi1> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<2x4x7x11xi1> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<2x4x7x11xi1> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.LogicalLeftShift - PRO-INT or PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @logicalleftshift_any_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @logicalleftshift_any_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @logicalleftshift_any_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @logicalleftshift_any, @logicalleftshift_any_arg_0, @logicalleftshift_any_arg_1, @logicalleftshift_any_res_0 + spirv.ARM.Graph @logicalleftshift_any(%arg0: !spirv.arm.tensor<7x1x11x4xi8>, %arg1: !spirv.arm.tensor<7x8x11x4xi8>) -> (!spirv.arm.tensor<7x8x11x4xi8>) { + // CHECK: {{%.*}} = spirv.Tosa.LogicalLeftShift %arg0, %arg1 : (!spirv.arm.tensor<7x1x11x4xi8>, !spirv.arm.tensor<7x8x11x4xi8>) -> !spirv.arm.tensor<7x8x11x4xi8> + %0 = spirv.Tosa.LogicalLeftShift %arg0, %arg1 : (!spirv.arm.tensor<7x1x11x4xi8>, !spirv.arm.tensor<7x8x11x4xi8>) -> !spirv.arm.tensor<7x8x11x4xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<7x8x11x4xi8> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<7x8x11x4xi8> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.LogicalRightShift - PRO-INT or PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @logicalrightshift_any_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @logicalrightshift_any_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @logicalrightshift_any_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @logicalrightshift_any, @logicalrightshift_any_arg_0, @logicalrightshift_any_arg_1, @logicalrightshift_any_res_0 + spirv.ARM.Graph @logicalrightshift_any(%arg0: !spirv.arm.tensor<6x13x1x19xi8>, %arg1: !spirv.arm.tensor<6x13x6x19xi8>) -> (!spirv.arm.tensor<6x13x6x19xi8>) { + // CHECK: {{%.*}} = spirv.Tosa.LogicalRightShift %arg0, %arg1 : (!spirv.arm.tensor<6x13x1x19xi8>, !spirv.arm.tensor<6x13x6x19xi8>) -> !spirv.arm.tensor<6x13x6x19xi8> + %0 = spirv.Tosa.LogicalRightShift %arg0, %arg1 : (!spirv.arm.tensor<6x13x1x19xi8>, !spirv.arm.tensor<6x13x6x19xi8>) -> !spirv.arm.tensor<6x13x6x19xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<6x13x6x19xi8> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<6x13x6x19xi8> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.LogicalOr - PRO-INT or PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @logicalor_any_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @logicalor_any_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @logicalor_any_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @logicalor_any, @logicalor_any_arg_0, @logicalor_any_arg_1, @logicalor_any_res_0 + spirv.ARM.Graph @logicalor_any(%arg0: !spirv.arm.tensor<3x6x12x5xi1>, %arg1: !spirv.arm.tensor<3x6x1x5xi1>) -> (!spirv.arm.tensor<3x6x12x5xi1>) { + // CHECK: {{%.*}} = spirv.Tosa.LogicalOr %arg0, %arg1 : (!spirv.arm.tensor<3x6x12x5xi1>, !spirv.arm.tensor<3x6x1x5xi1>) -> !spirv.arm.tensor<3x6x12x5xi1> + %0 = spirv.Tosa.LogicalOr %arg0, %arg1 : (!spirv.arm.tensor<3x6x12x5xi1>, !spirv.arm.tensor<3x6x1x5xi1>) -> !spirv.arm.tensor<3x6x12x5xi1> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<3x6x12x5xi1> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<3x6x12x5xi1> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.LogicalXor - PRO-INT or PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @logicalxor_any_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @logicalxor_any_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @logicalxor_any_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @logicalxor_any, @logicalxor_any_arg_0, @logicalxor_any_arg_1, @logicalxor_any_res_0 + spirv.ARM.Graph @logicalxor_any(%arg0: !spirv.arm.tensor<11x4x9x12xi1>, %arg1: !spirv.arm.tensor<11x4x9x1xi1>) -> (!spirv.arm.tensor<11x4x9x12xi1>) { + // CHECK: {{%.*}} = spirv.Tosa.LogicalXor %arg0, %arg1 : (!spirv.arm.tensor<11x4x9x12xi1>, !spirv.arm.tensor<11x4x9x1xi1>) -> !spirv.arm.tensor<11x4x9x12xi1> + %0 = spirv.Tosa.LogicalXor %arg0, %arg1 : (!spirv.arm.tensor<11x4x9x12xi1>, !spirv.arm.tensor<11x4x9x1xi1>) -> !spirv.arm.tensor<11x4x9x12xi1> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<11x4x9x12xi1> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<11x4x9x12xi1> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Maximum - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @maximum_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @maximum_int_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @maximum_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @maximum_int, @maximum_int_arg_0, @maximum_int_arg_1, @maximum_int_res_0 + spirv.ARM.Graph @maximum_int(%arg0: !spirv.arm.tensor<1x2x65533x1xi32>, %arg1: !spirv.arm.tensor<1x2x65533x2xi32>) -> (!spirv.arm.tensor<1x2x65533x2xi32>) { + %0 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.Maximum {{%.*}}, %arg0, %arg1 : (i32, !spirv.arm.tensor<1x2x65533x1xi32>, !spirv.arm.tensor<1x2x65533x2xi32>) -> !spirv.arm.tensor<1x2x65533x2xi32> + %1 = spirv.Tosa.Maximum %0, %arg0, %arg1 : (i32, !spirv.arm.tensor<1x2x65533x1xi32>, !spirv.arm.tensor<1x2x65533x2xi32>) -> !spirv.arm.tensor<1x2x65533x2xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x2x65533x2xi32> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<1x2x65533x2xi32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Maximum - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @maximum_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @maximum_fp_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @maximum_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @maximum_fp, @maximum_fp_arg_0, @maximum_fp_arg_1, @maximum_fp_res_0 + spirv.ARM.Graph @maximum_fp(%arg0: !spirv.arm.tensor<1x12x14x7xf16>, %arg1: !spirv.arm.tensor<11x12x14x7xf16>) -> (!spirv.arm.tensor<11x12x14x7xf16>) { + %0 = spirv.Constant 2 : i32 // CHECK: {{%.*}} = spirv.Tosa.Maximum {{%.*}}, %arg0, %arg1 : (i32, !spirv.arm.tensor<1x12x14x7xf16>, !spirv.arm.tensor<11x12x14x7xf16>) -> !spirv.arm.tensor<11x12x14x7xf16> + %1 = spirv.Tosa.Maximum %0, %arg0, %arg1 : (i32, !spirv.arm.tensor<1x12x14x7xf16>, !spirv.arm.tensor<11x12x14x7xf16>) -> !spirv.arm.tensor<11x12x14x7xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<11x12x14x7xf16> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<11x12x14x7xf16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Minimum - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @minimum_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @minimum_int_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @minimum_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @minimum_int, @minimum_int_arg_0, @minimum_int_arg_1, @minimum_int_res_0 + spirv.ARM.Graph @minimum_int(%arg0: !spirv.arm.tensor<15x2x10x11xi32>, %arg1: !spirv.arm.tensor<15x1x10x11xi32>) -> (!spirv.arm.tensor<15x2x10x11xi32>) { + %0 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.Minimum {{%.*}}, %arg0, %arg1 : (i32, !spirv.arm.tensor<15x2x10x11xi32>, !spirv.arm.tensor<15x1x10x11xi32>) -> !spirv.arm.tensor<15x2x10x11xi32> + %1 = spirv.Tosa.Minimum %0, %arg0, %arg1 : (i32, !spirv.arm.tensor<15x2x10x11xi32>, !spirv.arm.tensor<15x1x10x11xi32>) -> !spirv.arm.tensor<15x2x10x11xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<15x2x10x11xi32> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<15x2x10x11xi32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Minimum - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @minimum_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @minimum_fp_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @minimum_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @minimum_fp, @minimum_fp_arg_0, @minimum_fp_arg_1, @minimum_fp_res_0 + spirv.ARM.Graph @minimum_fp(%arg0: !spirv.arm.tensor<1x65531x2x1xf32>, %arg1: !spirv.arm.tensor<1x1x2x1xf32>) -> (!spirv.arm.tensor<1x65531x2x1xf32>) { + %0 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.Minimum {{%.*}}, %arg0, %arg1 : (i32, !spirv.arm.tensor<1x65531x2x1xf32>, !spirv.arm.tensor<1x1x2x1xf32>) -> !spirv.arm.tensor<1x65531x2x1xf32> + %1 = spirv.Tosa.Minimum %0, %arg0, %arg1 : (i32, !spirv.arm.tensor<1x65531x2x1xf32>, !spirv.arm.tensor<1x1x2x1xf32>) -> !spirv.arm.tensor<1x65531x2x1xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x65531x2x1xf32> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<1x65531x2x1xf32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Mul - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @mul_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @mul_int_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @mul_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @mul_int, @mul_int_arg_0, @mul_int_arg_1, @mul_int_res_0 + spirv.ARM.Graph @mul_int(%arg0: !spirv.arm.tensor<34x21x39xi32>, %arg1: !spirv.arm.tensor<34x21x1xi32>) -> (!spirv.arm.tensor<34x21x39xi32>) { + %0 = spirv.Constant dense<31> : !spirv.arm.tensor<1xi8> // CHECK: {{%.*}} = spirv.Tosa.Mul %arg0, %arg1, {{%.*}} : (!spirv.arm.tensor<34x21x39xi32>, !spirv.arm.tensor<34x21x1xi32>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<34x21x39xi32> + %1 = spirv.Tosa.Mul %arg0, %arg1, %0 : (!spirv.arm.tensor<34x21x39xi32>, !spirv.arm.tensor<34x21x1xi32>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<34x21x39xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<34x21x39xi32> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<34x21x39xi32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Mul - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @mul_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @mul_fp_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @mul_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @mul_fp, @mul_fp_arg_0, @mul_fp_arg_1, @mul_fp_res_0 + spirv.ARM.Graph @mul_fp(%arg0: !spirv.arm.tensor<57x1x55xf16>, %arg1: !spirv.arm.tensor<57x37x55xf16>) -> (!spirv.arm.tensor<57x37x55xf16>) { + %0 = spirv.Constant dense<0> : !spirv.arm.tensor<1xi8> // CHECK: {{%.*}} = spirv.Tosa.Mul %arg0, %arg1, {{%.*}} : (!spirv.arm.tensor<57x1x55xf16>, !spirv.arm.tensor<57x37x55xf16>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<57x37x55xf16> + %1 = spirv.Tosa.Mul %arg0, %arg1, %0 : (!spirv.arm.tensor<57x1x55xf16>, !spirv.arm.tensor<57x37x55xf16>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<57x37x55xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<57x37x55xf16> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<57x37x55xf16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Pow - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @pow_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @pow_fp_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @pow_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @pow_fp, @pow_fp_arg_0, @pow_fp_arg_1, @pow_fp_res_0 + spirv.ARM.Graph @pow_fp(%arg0: !spirv.arm.tensor<1x52x53xf16>, %arg1: !spirv.arm.tensor<44x52x53xf16>) -> (!spirv.arm.tensor<44x52x53xf16>) { + // CHECK: {{%.*}} = spirv.Tosa.Pow %arg0, %arg1 : (!spirv.arm.tensor<1x52x53xf16>, !spirv.arm.tensor<44x52x53xf16>) -> !spirv.arm.tensor<44x52x53xf16> + %0 = spirv.Tosa.Pow %arg0, %arg1 : (!spirv.arm.tensor<1x52x53xf16>, !spirv.arm.tensor<44x52x53xf16>) -> !spirv.arm.tensor<44x52x53xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<44x52x53xf16> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<44x52x53xf16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Sub - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @sub_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @sub_int_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @sub_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @sub_int, @sub_int_arg_0, @sub_int_arg_1, @sub_int_res_0 + spirv.ARM.Graph @sub_int(%arg0: !spirv.arm.tensor<6x10x6x6xi32>, %arg1: !spirv.arm.tensor<1x10x6x6xi32>) -> (!spirv.arm.tensor<6x10x6x6xi32>) { + // CHECK: {{%.*}} = spirv.Tosa.Sub %arg0, %arg1 : (!spirv.arm.tensor<6x10x6x6xi32>, !spirv.arm.tensor<1x10x6x6xi32>) -> !spirv.arm.tensor<6x10x6x6xi32> + %0 = spirv.Tosa.Sub %arg0, %arg1 : (!spirv.arm.tensor<6x10x6x6xi32>, !spirv.arm.tensor<1x10x6x6xi32>) -> !spirv.arm.tensor<6x10x6x6xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<6x10x6x6xi32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<6x10x6x6xi32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Sub - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @sub_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @sub_fp_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @sub_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @sub_fp, @sub_fp_arg_0, @sub_fp_arg_1, @sub_fp_res_0 + spirv.ARM.Graph @sub_fp(%arg0: !spirv.arm.tensor<1x10x13x12xf16>, %arg1: !spirv.arm.tensor<6x10x13x12xf16>) -> (!spirv.arm.tensor<6x10x13x12xf16>) { + // CHECK: {{%.*}} = spirv.Tosa.Sub %arg0, %arg1 : (!spirv.arm.tensor<1x10x13x12xf16>, !spirv.arm.tensor<6x10x13x12xf16>) -> !spirv.arm.tensor<6x10x13x12xf16> + %0 = spirv.Tosa.Sub %arg0, %arg1 : (!spirv.arm.tensor<1x10x13x12xf16>, !spirv.arm.tensor<6x10x13x12xf16>) -> !spirv.arm.tensor<6x10x13x12xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<6x10x13x12xf16> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<6x10x13x12xf16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Table - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @table_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @table_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @table_int, @table_int_arg_0, @table_int_res_0 + spirv.ARM.Graph @table_int(%arg0: !spirv.arm.tensor<3x2x15x7xi8>) -> (!spirv.arm.tensor<3x2x15x7xi8>) { + %0 = spirv.ARM.GraphConstant {graph_constant_id = 0 : i32}: !spirv.arm.tensor<256xi8> + // CHECK: {{%.*}} = spirv.Tosa.Table %arg0, {{%.*}} : (!spirv.arm.tensor<3x2x15x7xi8>, !spirv.arm.tensor<256xi8>) -> !spirv.arm.tensor<3x2x15x7xi8> + %1 = spirv.Tosa.Table %arg0, %0 : (!spirv.arm.tensor<3x2x15x7xi8>, !spirv.arm.tensor<256xi8>) -> !spirv.arm.tensor<3x2x15x7xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<3x2x15x7xi8> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<3x2x15x7xi8> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Abs - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @abs_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @abs_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @abs_int, @abs_int_arg_0, @abs_int_res_0 + spirv.ARM.Graph @abs_int(%arg0: !spirv.arm.tensor<5x1x4x4xi32>) -> (!spirv.arm.tensor<5x1x4x4xi32>) { + // CHECK: {{%.*}} = spirv.Tosa.Abs %arg0 : (!spirv.arm.tensor<5x1x4x4xi32>) -> !spirv.arm.tensor<5x1x4x4xi32> + %0 = spirv.Tosa.Abs %arg0 : (!spirv.arm.tensor<5x1x4x4xi32>) -> !spirv.arm.tensor<5x1x4x4xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<5x1x4x4xi32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<5x1x4x4xi32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Abs - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @abs_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @abs_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @abs_fp, @abs_fp_arg_0, @abs_fp_res_0 + spirv.ARM.Graph @abs_fp(%arg0: !spirv.arm.tensor<3x6x14x8xf16>) -> (!spirv.arm.tensor<3x6x14x8xf16>) { + // CHECK: {{%.*}} = spirv.Tosa.Abs %arg0 : (!spirv.arm.tensor<3x6x14x8xf16>) -> !spirv.arm.tensor<3x6x14x8xf16> + %0 = spirv.Tosa.Abs %arg0 : (!spirv.arm.tensor<3x6x14x8xf16>) -> !spirv.arm.tensor<3x6x14x8xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<3x6x14x8xf16> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<3x6x14x8xf16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.BitwiseNot - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @bitwisenot_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @bitwisenot_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @bitwisenot_int, @bitwisenot_int_arg_0, @bitwisenot_int_res_0 + spirv.ARM.Graph @bitwisenot_int(%arg0: !spirv.arm.tensor<12x56x50xi32>) -> (!spirv.arm.tensor<12x56x50xi32>) { + // CHECK: {{%.*}} = spirv.Tosa.BitwiseNot %arg0 : (!spirv.arm.tensor<12x56x50xi32>) -> !spirv.arm.tensor<12x56x50xi32> + %0 = spirv.Tosa.BitwiseNot %arg0 : (!spirv.arm.tensor<12x56x50xi32>) -> !spirv.arm.tensor<12x56x50xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<12x56x50xi32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<12x56x50xi32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Ceil - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @ceil_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @ceil_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @ceil_fp, @ceil_fp_arg_0, @ceil_fp_res_0 + spirv.ARM.Graph @ceil_fp(%arg0: !spirv.arm.tensor<46x55x53xf16>) -> (!spirv.arm.tensor<46x55x53xf16>) { + // CHECK: {{%.*}} = spirv.Tosa.Ceil %arg0 : (!spirv.arm.tensor<46x55x53xf16>) -> !spirv.arm.tensor<46x55x53xf16> + %0 = spirv.Tosa.Ceil %arg0 : (!spirv.arm.tensor<46x55x53xf16>) -> !spirv.arm.tensor<46x55x53xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<46x55x53xf16> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<46x55x53xf16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Clz - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @clz_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @clz_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @clz_int, @clz_int_arg_0, @clz_int_res_0 + spirv.ARM.Graph @clz_int(%arg0: !spirv.arm.tensor<14x10x7x5xi32>) -> (!spirv.arm.tensor<14x10x7x5xi32>) { + // CHECK: {{%.*}} = spirv.Tosa.Clz %arg0 : (!spirv.arm.tensor<14x10x7x5xi32>) -> !spirv.arm.tensor<14x10x7x5xi32> + %0 = spirv.Tosa.Clz %arg0 : (!spirv.arm.tensor<14x10x7x5xi32>) -> !spirv.arm.tensor<14x10x7x5xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<14x10x7x5xi32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<14x10x7x5xi32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Cos - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @cos_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @cos_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @cos_fp, @cos_fp_arg_0, @cos_fp_res_0 + spirv.ARM.Graph @cos_fp(%arg0: !spirv.arm.tensor<44x49x51xf32>) -> (!spirv.arm.tensor<44x49x51xf32>) { + // CHECK: {{%.*}} = spirv.Tosa.Cos %arg0 : (!spirv.arm.tensor<44x49x51xf32>) -> !spirv.arm.tensor<44x49x51xf32> + %0 = spirv.Tosa.Cos %arg0 : (!spirv.arm.tensor<44x49x51xf32>) -> !spirv.arm.tensor<44x49x51xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<44x49x51xf32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<44x49x51xf32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Exp - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @exp_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @exp_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @exp_fp, @exp_fp_arg_0, @exp_fp_res_0 + spirv.ARM.Graph @exp_fp(%arg0: !spirv.arm.tensor<37x53x47xf32>) -> (!spirv.arm.tensor<37x53x47xf32>) { + // CHECK: {{%.*}} = spirv.Tosa.Exp %arg0 : (!spirv.arm.tensor<37x53x47xf32>) -> !spirv.arm.tensor<37x53x47xf32> + %0 = spirv.Tosa.Exp %arg0 : (!spirv.arm.tensor<37x53x47xf32>) -> !spirv.arm.tensor<37x53x47xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<37x53x47xf32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<37x53x47xf32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Floor - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @floor_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @floor_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @floor_fp, @floor_fp_arg_0, @floor_fp_res_0 + spirv.ARM.Graph @floor_fp(%arg0: !spirv.arm.tensor<40x52x42xf32>) -> (!spirv.arm.tensor<40x52x42xf32>) { + // CHECK: {{%.*}} = spirv.Tosa.Floor %arg0 : (!spirv.arm.tensor<40x52x42xf32>) -> !spirv.arm.tensor<40x52x42xf32> + %0 = spirv.Tosa.Floor %arg0 : (!spirv.arm.tensor<40x52x42xf32>) -> !spirv.arm.tensor<40x52x42xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<40x52x42xf32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<40x52x42xf32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Log - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @log_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @log_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @log_fp, @log_fp_arg_0, @log_fp_res_0 + spirv.ARM.Graph @log_fp(%arg0: !spirv.arm.tensor<45x43x36xf16>) -> (!spirv.arm.tensor<45x43x36xf16>) { + // CHECK: {{%.*}} = spirv.Tosa.Log %arg0 : (!spirv.arm.tensor<45x43x36xf16>) -> !spirv.arm.tensor<45x43x36xf16> + %0 = spirv.Tosa.Log %arg0 : (!spirv.arm.tensor<45x43x36xf16>) -> !spirv.arm.tensor<45x43x36xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<45x43x36xf16> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<45x43x36xf16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.LogicalNot - PRO-INT or PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @logicalnot_any_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @logicalnot_any_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @logicalnot_any, @logicalnot_any_arg_0, @logicalnot_any_res_0 + spirv.ARM.Graph @logicalnot_any(%arg0: !spirv.arm.tensor<54x26x10xi1>) -> (!spirv.arm.tensor<54x26x10xi1>) { + // CHECK: {{%.*}} = spirv.Tosa.LogicalNot %arg0 : (!spirv.arm.tensor<54x26x10xi1>) -> !spirv.arm.tensor<54x26x10xi1> + %0 = spirv.Tosa.LogicalNot %arg0 : (!spirv.arm.tensor<54x26x10xi1>) -> !spirv.arm.tensor<54x26x10xi1> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<54x26x10xi1> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<54x26x10xi1> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Negate - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @negate_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @negate_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @negate_int, @negate_int_arg_0, @negate_int_res_0 + spirv.ARM.Graph @negate_int(%arg0: !spirv.arm.tensor<3x1x65540x1xi8>) -> (!spirv.arm.tensor<3x1x65540x1xi8>) { + %0 = spirv.Constant dense<111> : !spirv.arm.tensor<1xi8> + %1 = spirv.Constant dense<-32> : !spirv.arm.tensor<1xi8> // CHECK: {{%.*}} = spirv.Tosa.Negate %arg0, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<3x1x65540x1xi8>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<3x1x65540x1xi8> + %2 = spirv.Tosa.Negate %arg0, %0, %1 : (!spirv.arm.tensor<3x1x65540x1xi8>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<3x1x65540x1xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<3x1x65540x1xi8> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<3x1x65540x1xi8> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Negate - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @negate_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @negate_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @negate_fp, @negate_fp_arg_0, @negate_fp_res_0 + spirv.ARM.Graph @negate_fp(%arg0: !spirv.arm.tensor<2x7x15x13xf16>) -> (!spirv.arm.tensor<2x7x15x13xf16>) { + %0 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf16> + %1 = spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<1xf16> // CHECK: {{%.*}} = spirv.Tosa.Negate %arg0, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<2x7x15x13xf16>, !spirv.arm.tensor<1xf16>, !spirv.arm.tensor<1xf16>) -> !spirv.arm.tensor<2x7x15x13xf16> + %2 = spirv.Tosa.Negate %arg0, %0, %1 : (!spirv.arm.tensor<2x7x15x13xf16>, !spirv.arm.tensor<1xf16>, !spirv.arm.tensor<1xf16>) -> !spirv.arm.tensor<2x7x15x13xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<2x7x15x13xf16> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<2x7x15x13xf16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Reciprocal - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @reciprocal_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @reciprocal_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @reciprocal_fp, @reciprocal_fp_arg_0, @reciprocal_fp_res_0 + spirv.ARM.Graph @reciprocal_fp(%arg0: !spirv.arm.tensor<38x47x44xf32>) -> (!spirv.arm.tensor<38x47x44xf32>) { + // CHECK: {{%.*}} = spirv.Tosa.Reciprocal %arg0 : (!spirv.arm.tensor<38x47x44xf32>) -> !spirv.arm.tensor<38x47x44xf32> + %0 = spirv.Tosa.Reciprocal %arg0 : (!spirv.arm.tensor<38x47x44xf32>) -> !spirv.arm.tensor<38x47x44xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<38x47x44xf32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<38x47x44xf32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Rsqrt - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @rsqrt_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @rsqrt_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @rsqrt_fp, @rsqrt_fp_arg_0, @rsqrt_fp_res_0 + spirv.ARM.Graph @rsqrt_fp(%arg0: !spirv.arm.tensor<40x57x56xf32>) -> (!spirv.arm.tensor<40x57x56xf32>) { + // CHECK: {{%.*}} = spirv.Tosa.Rsqrt %arg0 : (!spirv.arm.tensor<40x57x56xf32>) -> !spirv.arm.tensor<40x57x56xf32> + %0 = spirv.Tosa.Rsqrt %arg0 : (!spirv.arm.tensor<40x57x56xf32>) -> !spirv.arm.tensor<40x57x56xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<40x57x56xf32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<40x57x56xf32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Sin - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @sin_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @sin_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @sin_fp, @sin_fp_arg_0, @sin_fp_res_0 + spirv.ARM.Graph @sin_fp(%arg0: !spirv.arm.tensor<49x38x58xf16>) -> (!spirv.arm.tensor<49x38x58xf16>) { + // CHECK: {{%.*}} = spirv.Tosa.Sin %arg0 : (!spirv.arm.tensor<49x38x58xf16>) -> !spirv.arm.tensor<49x38x58xf16> + %0 = spirv.Tosa.Sin %arg0 : (!spirv.arm.tensor<49x38x58xf16>) -> !spirv.arm.tensor<49x38x58xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<49x38x58xf16> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<49x38x58xf16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Select - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @select_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @select_int_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @select_int_arg_2 bind(0, 2) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @select_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @select_int, @select_int_arg_0, @select_int_arg_1, @select_int_arg_2, @select_int_res_0 + spirv.ARM.Graph @select_int(%arg0: !spirv.arm.tensor<4x1x4x5xi1>, %arg1: !spirv.arm.tensor<4x6x4x5xi8>, %arg2: !spirv.arm.tensor<4x6x4x5xi8>) -> (!spirv.arm.tensor<4x6x4x5xi8>) { + // CHECK: {{%.*}} = spirv.Tosa.Select %arg0, %arg1, %arg2 : (!spirv.arm.tensor<4x1x4x5xi1>, !spirv.arm.tensor<4x6x4x5xi8>, !spirv.arm.tensor<4x6x4x5xi8>) -> !spirv.arm.tensor<4x6x4x5xi8> + %0 = spirv.Tosa.Select %arg0, %arg1, %arg2 : (!spirv.arm.tensor<4x1x4x5xi1>, !spirv.arm.tensor<4x6x4x5xi8>, !spirv.arm.tensor<4x6x4x5xi8>) -> !spirv.arm.tensor<4x6x4x5xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<4x6x4x5xi8> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<4x6x4x5xi8> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Select - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @select_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @select_fp_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @select_fp_arg_2 bind(0, 2) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @select_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @select_fp, @select_fp_arg_0, @select_fp_arg_1, @select_fp_arg_2, @select_fp_res_0 + spirv.ARM.Graph @select_fp(%arg0: !spirv.arm.tensor<9x2x15x8xi1>, %arg1: !spirv.arm.tensor<9x2x15x8xf16>, %arg2: !spirv.arm.tensor<9x1x15x8xf16>) -> (!spirv.arm.tensor<9x2x15x8xf16>) { + // CHECK: {{%.*}} = spirv.Tosa.Select %arg0, %arg1, %arg2 : (!spirv.arm.tensor<9x2x15x8xi1>, !spirv.arm.tensor<9x2x15x8xf16>, !spirv.arm.tensor<9x1x15x8xf16>) -> !spirv.arm.tensor<9x2x15x8xf16> + %0 = spirv.Tosa.Select %arg0, %arg1, %arg2 : (!spirv.arm.tensor<9x2x15x8xi1>, !spirv.arm.tensor<9x2x15x8xf16>, !spirv.arm.tensor<9x1x15x8xf16>) -> !spirv.arm.tensor<9x2x15x8xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<9x2x15x8xf16> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<9x2x15x8xf16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Equal - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @equal_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @equal_int_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @equal_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @equal_int, @equal_int_arg_0, @equal_int_arg_1, @equal_int_res_0 + spirv.ARM.Graph @equal_int(%arg0: !spirv.arm.tensor<51x28x59xi32>, %arg1: !spirv.arm.tensor<51x1x59xi32>) -> (!spirv.arm.tensor<51x28x59xi1>) { + // CHECK: {{%.*}} = spirv.Tosa.Equal %arg0, %arg1 : (!spirv.arm.tensor<51x28x59xi32>, !spirv.arm.tensor<51x1x59xi32>) -> !spirv.arm.tensor<51x28x59xi1> + %0 = spirv.Tosa.Equal %arg0, %arg1 : (!spirv.arm.tensor<51x28x59xi32>, !spirv.arm.tensor<51x1x59xi32>) -> !spirv.arm.tensor<51x28x59xi1> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<51x28x59xi1> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<51x28x59xi1> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Equal - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @equal_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @equal_fp_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @equal_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @equal_fp, @equal_fp_arg_0, @equal_fp_arg_1, @equal_fp_res_0 + spirv.ARM.Graph @equal_fp(%arg0: !spirv.arm.tensor<16x11x5x3xf32>, %arg1: !spirv.arm.tensor<16x1x5x3xf32>) -> (!spirv.arm.tensor<16x11x5x3xi1>) { + // CHECK: {{%.*}} = spirv.Tosa.Equal %arg0, %arg1 : (!spirv.arm.tensor<16x11x5x3xf32>, !spirv.arm.tensor<16x1x5x3xf32>) -> !spirv.arm.tensor<16x11x5x3xi1> + %0 = spirv.Tosa.Equal %arg0, %arg1 : (!spirv.arm.tensor<16x11x5x3xf32>, !spirv.arm.tensor<16x1x5x3xf32>) -> !spirv.arm.tensor<16x11x5x3xi1> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<16x11x5x3xi1> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<16x11x5x3xi1> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Greater - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @greater_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @greater_int_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @greater_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @greater_int, @greater_int_arg_0, @greater_int_arg_1, @greater_int_res_0 + spirv.ARM.Graph @greater_int(%arg0: !spirv.arm.tensor<11x10x10x2xi32>, %arg1: !spirv.arm.tensor<11x10x10x1xi32>) -> (!spirv.arm.tensor<11x10x10x2xi1>) { + // CHECK: {{%.*}} = spirv.Tosa.Greater %arg0, %arg1 : (!spirv.arm.tensor<11x10x10x2xi32>, !spirv.arm.tensor<11x10x10x1xi32>) -> !spirv.arm.tensor<11x10x10x2xi1> + %0 = spirv.Tosa.Greater %arg0, %arg1 : (!spirv.arm.tensor<11x10x10x2xi32>, !spirv.arm.tensor<11x10x10x1xi32>) -> !spirv.arm.tensor<11x10x10x2xi1> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<11x10x10x2xi1> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<11x10x10x2xi1> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Greater - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @greater_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @greater_fp_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @greater_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @greater_fp, @greater_fp_arg_0, @greater_fp_arg_1, @greater_fp_res_0 + spirv.ARM.Graph @greater_fp(%arg0: !spirv.arm.tensor<6x3x12x4xf16>, %arg1: !spirv.arm.tensor<6x3x1x4xf16>) -> (!spirv.arm.tensor<6x3x12x4xi1>) { + // CHECK: {{%.*}} = spirv.Tosa.Greater %arg0, %arg1 : (!spirv.arm.tensor<6x3x12x4xf16>, !spirv.arm.tensor<6x3x1x4xf16>) -> !spirv.arm.tensor<6x3x12x4xi1> + %0 = spirv.Tosa.Greater %arg0, %arg1 : (!spirv.arm.tensor<6x3x12x4xf16>, !spirv.arm.tensor<6x3x1x4xf16>) -> !spirv.arm.tensor<6x3x12x4xi1> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<6x3x12x4xi1> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<6x3x12x4xi1> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.GreaterEqual - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @greaterequal_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @greaterequal_int_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @greaterequal_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @greaterequal_int, @greaterequal_int_arg_0, @greaterequal_int_arg_1, @greaterequal_int_res_0 + spirv.ARM.Graph @greaterequal_int(%arg0: !spirv.arm.tensor<10x17x7x1xi32>, %arg1: !spirv.arm.tensor<10x17x7x16xi32>) -> (!spirv.arm.tensor<10x17x7x16xi1>) { + // CHECK: {{%.*}} = spirv.Tosa.GreaterEqual %arg0, %arg1 : (!spirv.arm.tensor<10x17x7x1xi32>, !spirv.arm.tensor<10x17x7x16xi32>) -> !spirv.arm.tensor<10x17x7x16xi1> + %0 = spirv.Tosa.GreaterEqual %arg0, %arg1 : (!spirv.arm.tensor<10x17x7x1xi32>, !spirv.arm.tensor<10x17x7x16xi32>) -> !spirv.arm.tensor<10x17x7x16xi1> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<10x17x7x16xi1> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<10x17x7x16xi1> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.GreaterEqual - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @greaterequal_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @greaterequal_fp_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @greaterequal_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @greaterequal_fp, @greaterequal_fp_arg_0, @greaterequal_fp_arg_1, @greaterequal_fp_res_0 + spirv.ARM.Graph @greaterequal_fp(%arg0: !spirv.arm.tensor<3x17x6x3xf32>, %arg1: !spirv.arm.tensor<1x17x6x3xf32>) -> (!spirv.arm.tensor<3x17x6x3xi1>) { + // CHECK: {{%.*}} = spirv.Tosa.GreaterEqual %arg0, %arg1 : (!spirv.arm.tensor<3x17x6x3xf32>, !spirv.arm.tensor<1x17x6x3xf32>) -> !spirv.arm.tensor<3x17x6x3xi1> + %0 = spirv.Tosa.GreaterEqual %arg0, %arg1 : (!spirv.arm.tensor<3x17x6x3xf32>, !spirv.arm.tensor<1x17x6x3xf32>) -> !spirv.arm.tensor<3x17x6x3xi1> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<3x17x6x3xi1> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<3x17x6x3xi1> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.ReduceAll - PRO-INT or PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @reduceall_any_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @reduceall_any_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @reduceall_any, @reduceall_any_arg_0, @reduceall_any_res_0 + spirv.ARM.Graph @reduceall_any(%arg0: !spirv.arm.tensor<18x22x23x12xi1>) -> (!spirv.arm.tensor<18x22x1x12xi1>) { + %0 = spirv.Constant 2 : i32 // CHECK: {{%.*}} = spirv.Tosa.ReduceAll {{%.*}}, %arg0 : (i32, !spirv.arm.tensor<18x22x23x12xi1>) -> !spirv.arm.tensor<18x22x1x12xi1> + %1 = spirv.Tosa.ReduceAll %0, %arg0 : (i32, !spirv.arm.tensor<18x22x23x12xi1>) -> !spirv.arm.tensor<18x22x1x12xi1> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<18x22x1x12xi1> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<18x22x1x12xi1> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.ReduceAny - PRO-INT or PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @reduceany_any_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @reduceany_any_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @reduceany_any, @reduceany_any_arg_0, @reduceany_any_res_0 + spirv.ARM.Graph @reduceany_any(%arg0: !spirv.arm.tensor<25x13x30x8xi1>) -> (!spirv.arm.tensor<25x13x1x8xi1>) { + %0 = spirv.Constant 2 : i32 // CHECK: {{%.*}} = spirv.Tosa.ReduceAny {{%.*}}, %arg0 : (i32, !spirv.arm.tensor<25x13x30x8xi1>) -> !spirv.arm.tensor<25x13x1x8xi1> + %1 = spirv.Tosa.ReduceAny %0, %arg0 : (i32, !spirv.arm.tensor<25x13x30x8xi1>) -> !spirv.arm.tensor<25x13x1x8xi1> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<25x13x1x8xi1> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<25x13x1x8xi1> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.ReduceMax - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @reducemax_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @reducemax_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @reducemax_int, @reducemax_int_arg_0, @reducemax_int_res_0 + spirv.ARM.Graph @reducemax_int(%arg0: !spirv.arm.tensor<8x30x12x3xi8>) -> (!spirv.arm.tensor<8x30x1x3xi8>) { + %0 = spirv.Constant 2 : i32 + %1 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.ReduceMax {{%.*}}, {{%.*}}, %arg0 : (i32, i32, !spirv.arm.tensor<8x30x12x3xi8>) -> !spirv.arm.tensor<8x30x1x3xi8> + %2 = spirv.Tosa.ReduceMax %0, %1, %arg0 : (i32, i32, !spirv.arm.tensor<8x30x12x3xi8>) -> !spirv.arm.tensor<8x30x1x3xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<8x30x1x3xi8> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<8x30x1x3xi8> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.ReduceMax - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @reducemax_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @reducemax_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @reducemax_fp, @reducemax_fp_arg_0, @reducemax_fp_res_0 + spirv.ARM.Graph @reducemax_fp(%arg0: !spirv.arm.tensor<16x20x10xf16>) -> (!spirv.arm.tensor<16x20x1xf16>) { + %0 = spirv.Constant 2 : i32 + %1 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.ReduceMax {{%.*}}, {{%.*}}, %arg0 : (i32, i32, !spirv.arm.tensor<16x20x10xf16>) -> !spirv.arm.tensor<16x20x1xf16> + %2 = spirv.Tosa.ReduceMax %0, %1, %arg0 : (i32, i32, !spirv.arm.tensor<16x20x10xf16>) -> !spirv.arm.tensor<16x20x1xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<16x20x1xf16> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<16x20x1xf16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.ReduceMin - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @reducemin_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @reducemin_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @reducemin_int, @reducemin_int_arg_0, @reducemin_int_res_0 + spirv.ARM.Graph @reducemin_int(%arg0: !spirv.arm.tensor<2x5x5x1xi8>) -> (!spirv.arm.tensor<2x5x1x1xi8>) { + %0 = spirv.Constant 2 : i32 + %1 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.ReduceMin {{%.*}}, {{%.*}}, %arg0 : (i32, i32, !spirv.arm.tensor<2x5x5x1xi8>) -> !spirv.arm.tensor<2x5x1x1xi8> + %2 = spirv.Tosa.ReduceMin %0, %1, %arg0 : (i32, i32, !spirv.arm.tensor<2x5x5x1xi8>) -> !spirv.arm.tensor<2x5x1x1xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<2x5x1x1xi8> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<2x5x1x1xi8> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.ReduceMin - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @reducemin_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @reducemin_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @reducemin_fp, @reducemin_fp_arg_0, @reducemin_fp_res_0 + spirv.ARM.Graph @reducemin_fp(%arg0: !spirv.arm.tensor<27x10x25x9xf16>) -> (!spirv.arm.tensor<27x10x1x9xf16>) { + %0 = spirv.Constant 2 : i32 + %1 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.ReduceMin {{%.*}}, {{%.*}}, %arg0 : (i32, i32, !spirv.arm.tensor<27x10x25x9xf16>) -> !spirv.arm.tensor<27x10x1x9xf16> + %2 = spirv.Tosa.ReduceMin %0, %1, %arg0 : (i32, i32, !spirv.arm.tensor<27x10x25x9xf16>) -> !spirv.arm.tensor<27x10x1x9xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<27x10x1x9xf16> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<27x10x1x9xf16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.ReduceProduct - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @reduceproduct_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @reduceproduct_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @reduceproduct_fp, @reduceproduct_fp_arg_0, @reduceproduct_fp_res_0 + spirv.ARM.Graph @reduceproduct_fp(%arg0: !spirv.arm.tensor<2x16x25xf16>) -> (!spirv.arm.tensor<2x16x1xf16>) { + %0 = spirv.Constant 2 : i32 // CHECK: {{%.*}} = spirv.Tosa.ReduceProduct {{%.*}}, %arg0 : (i32, !spirv.arm.tensor<2x16x25xf16>) -> !spirv.arm.tensor<2x16x1xf16> + %1 = spirv.Tosa.ReduceProduct %0, %arg0 : (i32, !spirv.arm.tensor<2x16x25xf16>) -> !spirv.arm.tensor<2x16x1xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<2x16x1xf16> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<2x16x1xf16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.ReduceSum - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @reducesum_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @reducesum_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @reducesum_int, @reducesum_int_arg_0, @reducesum_int_res_0 + spirv.ARM.Graph @reducesum_int(%arg0: !spirv.arm.tensor<20x24x22xi32>) -> (!spirv.arm.tensor<20x1x22xi32>) { + %0 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.ReduceSum {{%.*}}, %arg0 : (i32, !spirv.arm.tensor<20x24x22xi32>) -> !spirv.arm.tensor<20x1x22xi32> + %1 = spirv.Tosa.ReduceSum %0, %arg0 : (i32, !spirv.arm.tensor<20x24x22xi32>) -> !spirv.arm.tensor<20x1x22xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<20x1x22xi32> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<20x1x22xi32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.ReduceSum - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @reducesum_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @reducesum_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @reducesum_fp, @reducesum_fp_arg_0, @reducesum_fp_res_0 + spirv.ARM.Graph @reducesum_fp(%arg0: !spirv.arm.tensor<32x32x33xf32>) -> (!spirv.arm.tensor<32x1x33xf32>) { + %0 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.ReduceSum {{%.*}}, %arg0 : (i32, !spirv.arm.tensor<32x32x33xf32>) -> !spirv.arm.tensor<32x1x33xf32> + %1 = spirv.Tosa.ReduceSum %0, %arg0 : (i32, !spirv.arm.tensor<32x32x33xf32>) -> !spirv.arm.tensor<32x1x33xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<32x1x33xf32> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<32x1x33xf32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Concat - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @concat_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @concat_int_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @concat_int_arg_2 bind(0, 2) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @concat_int_arg_3 bind(0, 3) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @concat_int_res_0 bind(0, 4) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @concat_int, @concat_int_arg_0, @concat_int_arg_1, @concat_int_arg_2, @concat_int_arg_3, @concat_int_res_0 + spirv.ARM.Graph @concat_int(%arg0: !spirv.arm.tensor<12x13x3x14xi8>, %arg1: !spirv.arm.tensor<12x13x3x14xi8>, %arg2: !spirv.arm.tensor<12x13x3x14xi8>, %arg3: !spirv.arm.tensor<12x13x3x14xi8>) -> (!spirv.arm.tensor<12x13x12x14xi8>) { + %0 = spirv.Constant 2 : i32 + // CHECK: {{%.*}} = spirv.Tosa.Concat {{%.*}}, %arg0, %arg1, %arg2, %arg3 : (i32, !spirv.arm.tensor<12x13x3x14xi8>, !spirv.arm.tensor<12x13x3x14xi8>, !spirv.arm.tensor<12x13x3x14xi8>, !spirv.arm.tensor<12x13x3x14xi8>) -> !spirv.arm.tensor<12x13x12x14xi8> + %1 = spirv.Tosa.Concat %0, %arg0, %arg1, %arg2, %arg3 : (i32, !spirv.arm.tensor<12x13x3x14xi8>, !spirv.arm.tensor<12x13x3x14xi8>, !spirv.arm.tensor<12x13x3x14xi8>, !spirv.arm.tensor<12x13x3x14xi8>) -> !spirv.arm.tensor<12x13x12x14xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<12x13x12x14xi8> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<12x13x12x14xi8> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Concat - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @concat_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @concat_fp_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @concat_fp_arg_2 bind(0, 2) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @concat_fp_res_0 bind(0, 3) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @concat_fp, @concat_fp_arg_0, @concat_fp_arg_1, @concat_fp_arg_2, @concat_fp_res_0 + spirv.ARM.Graph @concat_fp(%arg0: !spirv.arm.tensor<40x31x19xf32>, %arg1: !spirv.arm.tensor<40x15x19xf32>, %arg2: !spirv.arm.tensor<40x16x19xf32>) -> (!spirv.arm.tensor<40x62x19xf32>) { + %0 = spirv.Constant 1 : i32 + // CHECK: {{%.*}} = spirv.Tosa.Concat {{%.*}}, %arg0, %arg1, %arg2 : (i32, !spirv.arm.tensor<40x31x19xf32>, !spirv.arm.tensor<40x15x19xf32>, !spirv.arm.tensor<40x16x19xf32>) -> !spirv.arm.tensor<40x62x19xf32> + %1 = spirv.Tosa.Concat %0, %arg0, %arg1, %arg2 : (i32, !spirv.arm.tensor<40x31x19xf32>, !spirv.arm.tensor<40x15x19xf32>, !spirv.arm.tensor<40x16x19xf32>) -> !spirv.arm.tensor<40x62x19xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<40x62x19xf32> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<40x62x19xf32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Pad - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @pad_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @pad_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @pad_int, @pad_int_arg_0, @pad_int_res_0 + spirv.ARM.Graph @pad_int(%arg0: !spirv.arm.tensor<4x7xi8>) -> (!spirv.arm.tensor<21x19xi8>) { + %0 = spirv.Constant dense<[10, 7, 6, 6]> : !spirv.arm.tensor<4xi32> + %1 = spirv.Constant dense<-76> : !spirv.arm.tensor<1xi8> // CHECK: {{%.*}} = spirv.Tosa.Pad %arg0, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<4x7xi8>, !spirv.arm.tensor<4xi32>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<21x19xi8> + %2 = spirv.Tosa.Pad %arg0, %0, %1 : (!spirv.arm.tensor<4x7xi8>, !spirv.arm.tensor<4xi32>, !spirv.arm.tensor<1xi8>) -> !spirv.arm.tensor<21x19xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<21x19xi8> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<21x19xi8> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Pad - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @pad_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @pad_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @pad_fp, @pad_fp_arg_0, @pad_fp_res_0 + spirv.ARM.Graph @pad_fp(%arg0: !spirv.arm.tensor<2x9x2x3xf32>) -> (!spirv.arm.tensor<4x9x4x4xf32>) { + %0 = spirv.Constant dense<[1, 1, 0, 0, 1, 1, 0, 1]> : !spirv.arm.tensor<8xi32> + %1 = spirv.Constant dense<1.216309e+38> : !spirv.arm.tensor<1xf32> // CHECK: {{%.*}} = spirv.Tosa.Pad %arg0, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<2x9x2x3xf32>, !spirv.arm.tensor<8xi32>, !spirv.arm.tensor<1xf32>) -> !spirv.arm.tensor<4x9x4x4xf32> + %2 = spirv.Tosa.Pad %arg0, %0, %1 : (!spirv.arm.tensor<2x9x2x3xf32>, !spirv.arm.tensor<8xi32>, !spirv.arm.tensor<1xf32>) -> !spirv.arm.tensor<4x9x4x4xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<4x9x4x4xf32> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<4x9x4x4xf32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Reshape - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @reshape_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @reshape_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @reshape_int, @reshape_int_arg_0, @reshape_int_res_0 + spirv.ARM.Graph @reshape_int(%arg0: !spirv.arm.tensor<25x6x29x35xi16>) -> (!spirv.arm.tensor<125x6x7x29xi16>) { + %0 = spirv.Constant dense<[125, 6, 7, 29]> : !spirv.arm.tensor<4xi32> // CHECK: {{%.*}} = spirv.Tosa.Reshape %arg0, {{%.*}} : (!spirv.arm.tensor<25x6x29x35xi16>, !spirv.arm.tensor<4xi32>) -> !spirv.arm.tensor<125x6x7x29xi16> + %1 = spirv.Tosa.Reshape %arg0, %0 : (!spirv.arm.tensor<25x6x29x35xi16>, !spirv.arm.tensor<4xi32>) -> !spirv.arm.tensor<125x6x7x29xi16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<125x6x7x29xi16> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<125x6x7x29xi16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Reshape - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @reshape_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @reshape_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @reshape_fp, @reshape_fp_arg_0, @reshape_fp_res_0 + spirv.ARM.Graph @reshape_fp(%arg0: !spirv.arm.tensor<1x2x7x2xf32>) -> (!spirv.arm.tensor<2x1x14xf32>) { + %0 = spirv.Constant dense<[2, 1, 14]> : !spirv.arm.tensor<3xi32> // CHECK: {{%.*}} = spirv.Tosa.Reshape %arg0, {{%.*}} : (!spirv.arm.tensor<1x2x7x2xf32>, !spirv.arm.tensor<3xi32>) -> !spirv.arm.tensor<2x1x14xf32> + %1 = spirv.Tosa.Reshape %arg0, %0 : (!spirv.arm.tensor<1x2x7x2xf32>, !spirv.arm.tensor<3xi32>) -> !spirv.arm.tensor<2x1x14xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<2x1x14xf32> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<2x1x14xf32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Reverse - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @reverse_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @reverse_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @reverse_int, @reverse_int_arg_0, @reverse_int_res_0 + spirv.ARM.Graph @reverse_int(%arg0: !spirv.arm.tensor<20x5x28x31xi32>) -> (!spirv.arm.tensor<20x5x28x31xi32>) { + %0 = spirv.Constant 2 : i32 // CHECK: {{%.*}} = spirv.Tosa.Reverse {{%.*}}, %arg0 : (i32, !spirv.arm.tensor<20x5x28x31xi32>) -> !spirv.arm.tensor<20x5x28x31xi32> + %1 = spirv.Tosa.Reverse %0, %arg0 : (i32, !spirv.arm.tensor<20x5x28x31xi32>) -> !spirv.arm.tensor<20x5x28x31xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<20x5x28x31xi32> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<20x5x28x31xi32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Reverse - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @reverse_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @reverse_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @reverse_fp, @reverse_fp_arg_0, @reverse_fp_res_0 + spirv.ARM.Graph @reverse_fp(%arg0: !spirv.arm.tensor<21x34x47xf32>) -> (!spirv.arm.tensor<21x34x47xf32>) { + %0 = spirv.Constant 1 : i32 // CHECK: {{%.*}} = spirv.Tosa.Reverse {{%.*}}, %arg0 : (i32, !spirv.arm.tensor<21x34x47xf32>) -> !spirv.arm.tensor<21x34x47xf32> + %1 = spirv.Tosa.Reverse %0, %arg0 : (i32, !spirv.arm.tensor<21x34x47xf32>) -> !spirv.arm.tensor<21x34x47xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<21x34x47xf32> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<21x34x47xf32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Slice - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @slice_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @slice_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @slice_int, @slice_int_arg_0, @slice_int_res_0 + spirv.ARM.Graph @slice_int(%arg0: !spirv.arm.tensor<32x19x41xi8>) -> (!spirv.arm.tensor<21x5x2xi8>) { + %0 = spirv.Constant dense<[8, 11, 39]> : !spirv.arm.tensor<3xi32> + %1 = spirv.Constant dense<[21, 5, 2]> : !spirv.arm.tensor<3xi32> // CHECK: {{%.*}} = spirv.Tosa.Slice %arg0, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<32x19x41xi8>, !spirv.arm.tensor<3xi32>, !spirv.arm.tensor<3xi32>) -> !spirv.arm.tensor<21x5x2xi8> + %2 = spirv.Tosa.Slice %arg0, %0, %1 : (!spirv.arm.tensor<32x19x41xi8>, !spirv.arm.tensor<3xi32>, !spirv.arm.tensor<3xi32>) -> !spirv.arm.tensor<21x5x2xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<21x5x2xi8> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<21x5x2xi8> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Slice - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @slice_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @slice_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @slice_fp, @slice_fp_arg_0, @slice_fp_res_0 + spirv.ARM.Graph @slice_fp(%arg0: !spirv.arm.tensor<30x45x29xf32>) -> (!spirv.arm.tensor<5x12x11xf32>) { + %0 = spirv.Constant dense<[21, 20, 10]> : !spirv.arm.tensor<3xi32> + %1 = spirv.Constant dense<[5, 12, 11]> : !spirv.arm.tensor<3xi32> // CHECK: {{%.*}} = spirv.Tosa.Slice %arg0, {{%.*}}, {{%.*}} : (!spirv.arm.tensor<30x45x29xf32>, !spirv.arm.tensor<3xi32>, !spirv.arm.tensor<3xi32>) -> !spirv.arm.tensor<5x12x11xf32> + %2 = spirv.Tosa.Slice %arg0, %0, %1 : (!spirv.arm.tensor<30x45x29xf32>, !spirv.arm.tensor<3xi32>, !spirv.arm.tensor<3xi32>) -> !spirv.arm.tensor<5x12x11xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<5x12x11xf32> + spirv.ARM.GraphOutputs %2 : !spirv.arm.tensor<5x12x11xf32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Tile - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @tile_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @tile_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @tile_int, @tile_int_arg_0, @tile_int_res_0 + spirv.ARM.Graph @tile_int(%arg0: !spirv.arm.tensor<10x28x21xi16>) -> (!spirv.arm.tensor<10x28x63xi16>) { + %0 = spirv.Constant dense<[1, 1, 3]> : !spirv.arm.tensor<3xi32> // CHECK: {{%.*}} = spirv.Tosa.Tile %arg0, {{%.*}} : (!spirv.arm.tensor<10x28x21xi16>, !spirv.arm.tensor<3xi32>) -> !spirv.arm.tensor<10x28x63xi16> + %1 = spirv.Tosa.Tile %arg0, %0 : (!spirv.arm.tensor<10x28x21xi16>, !spirv.arm.tensor<3xi32>) -> !spirv.arm.tensor<10x28x63xi16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<10x28x63xi16> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<10x28x63xi16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Tile - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @tile_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @tile_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @tile_fp, @tile_fp_arg_0, @tile_fp_res_0 + spirv.ARM.Graph @tile_fp(%arg0: !spirv.arm.tensor<31x19x5xf16>) -> (!spirv.arm.tensor<62x57x10xf16>) { + %0 = spirv.Constant dense<[2, 3, 2]> : !spirv.arm.tensor<3xi32> // CHECK: {{%.*}} = spirv.Tosa.Tile %arg0, {{%.*}} : (!spirv.arm.tensor<31x19x5xf16>, !spirv.arm.tensor<3xi32>) -> !spirv.arm.tensor<62x57x10xf16> + %1 = spirv.Tosa.Tile %arg0, %0 : (!spirv.arm.tensor<31x19x5xf16>, !spirv.arm.tensor<3xi32>) -> !spirv.arm.tensor<62x57x10xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<62x57x10xf16> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<62x57x10xf16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Transpose - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @transpose_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @transpose_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @transpose_int, @transpose_int_arg_0, @transpose_int_res_0 + spirv.ARM.Graph @transpose_int(%arg0: !spirv.arm.tensor<14x28x1x61xi16>) -> (!spirv.arm.tensor<1x14x28x61xi16>) { + %0 = spirv.Constant dense<[2, 0, 1, 3]> : !spirv.arm.tensor<4xi32> // CHECK: {{%.*}} = spirv.Tosa.Transpose {{%.*}}, %arg0 : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<14x28x1x61xi16>) -> !spirv.arm.tensor<1x14x28x61xi16> + %1 = spirv.Tosa.Transpose %0, %arg0 : (!spirv.arm.tensor<4xi32>, !spirv.arm.tensor<14x28x1x61xi16>) -> !spirv.arm.tensor<1x14x28x61xi16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x14x28x61xi16> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<1x14x28x61xi16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Transpose - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @transpose_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @transpose_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @transpose_fp, @transpose_fp_arg_0, @transpose_fp_res_0 + spirv.ARM.Graph @transpose_fp(%arg0: !spirv.arm.tensor<42x22x49xi1>) -> (!spirv.arm.tensor<49x42x22xi1>) { + %0 = spirv.Constant dense<[2, 0, 1]> : !spirv.arm.tensor<3xi32> // CHECK: {{%.*}} = spirv.Tosa.Transpose {{%.*}}, %arg0 : (!spirv.arm.tensor<3xi32>, !spirv.arm.tensor<42x22x49xi1>) -> !spirv.arm.tensor<49x42x22xi1> + %1 = spirv.Tosa.Transpose %0, %arg0 : (!spirv.arm.tensor<3xi32>, !spirv.arm.tensor<42x22x49xi1>) -> !spirv.arm.tensor<49x42x22xi1> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<49x42x22xi1> + spirv.ARM.GraphOutputs %1 : !spirv.arm.tensor<49x42x22xi1> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Gather - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @gather_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @gather_int_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @gather_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @gather_int, @gather_int_arg_0, @gather_int_arg_1, @gather_int_res_0 + spirv.ARM.Graph @gather_int(%arg0: !spirv.arm.tensor<31x11x45xi32>, %arg1: !spirv.arm.tensor<31x15xi32>) -> (!spirv.arm.tensor<31x15x45xi32>) { + // CHECK: {{%.*}} = spirv.Tosa.Gather %arg0, %arg1 : (!spirv.arm.tensor<31x11x45xi32>, !spirv.arm.tensor<31x15xi32>) -> !spirv.arm.tensor<31x15x45xi32> + %0 = spirv.Tosa.Gather %arg0, %arg1 : (!spirv.arm.tensor<31x11x45xi32>, !spirv.arm.tensor<31x15xi32>) -> !spirv.arm.tensor<31x15x45xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<31x15x45xi32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<31x15x45xi32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Gather - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @gather_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @gather_fp_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @gather_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @gather_fp, @gather_fp_arg_0, @gather_fp_arg_1, @gather_fp_res_0 + spirv.ARM.Graph @gather_fp(%arg0: !spirv.arm.tensor<59x61x19xf32>, %arg1: !spirv.arm.tensor<59x65xi32>) -> (!spirv.arm.tensor<59x65x19xf32>) { + // CHECK: {{%.*}} = spirv.Tosa.Gather %arg0, %arg1 : (!spirv.arm.tensor<59x61x19xf32>, !spirv.arm.tensor<59x65xi32>) -> !spirv.arm.tensor<59x65x19xf32> + %0 = spirv.Tosa.Gather %arg0, %arg1 : (!spirv.arm.tensor<59x61x19xf32>, !spirv.arm.tensor<59x65xi32>) -> !spirv.arm.tensor<59x65x19xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<59x65x19xf32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<59x65x19xf32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Scatter - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @scatter_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @scatter_int_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @scatter_int_arg_2 bind(0, 2) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @scatter_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @scatter_int, @scatter_int_arg_0, @scatter_int_arg_1, @scatter_int_arg_2, @scatter_int_res_0 + spirv.ARM.Graph @scatter_int(%arg0: !spirv.arm.tensor<34x28x54xi32>, %arg1: !spirv.arm.tensor<34x18xi32>, %arg2: !spirv.arm.tensor<34x18x54xi32>) -> (!spirv.arm.tensor<34x28x54xi32>) { + // CHECK: {{%.*}} = spirv.Tosa.Scatter %arg0, %arg1, %arg2 : (!spirv.arm.tensor<34x28x54xi32>, !spirv.arm.tensor<34x18xi32>, !spirv.arm.tensor<34x18x54xi32>) -> !spirv.arm.tensor<34x28x54xi32> + %0 = spirv.Tosa.Scatter %arg0, %arg1, %arg2 : (!spirv.arm.tensor<34x28x54xi32>, !spirv.arm.tensor<34x18xi32>, !spirv.arm.tensor<34x18x54xi32>) -> !spirv.arm.tensor<34x28x54xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<34x28x54xi32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<34x28x54xi32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Scatter - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @scatter_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @scatter_fp_arg_1 bind(0, 1) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @scatter_fp_arg_2 bind(0, 2) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @scatter_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @scatter_fp, @scatter_fp_arg_0, @scatter_fp_arg_1, @scatter_fp_arg_2, @scatter_fp_res_0 + spirv.ARM.Graph @scatter_fp(%arg0: !spirv.arm.tensor<18x34x25xf16>, %arg1: !spirv.arm.tensor<18x20xi32>, %arg2: !spirv.arm.tensor<18x20x25xf16>) -> (!spirv.arm.tensor<18x34x25xf16>) { + // CHECK: {{%.*}} = spirv.Tosa.Scatter %arg0, %arg1, %arg2 : (!spirv.arm.tensor<18x34x25xf16>, !spirv.arm.tensor<18x20xi32>, !spirv.arm.tensor<18x20x25xf16>) -> !spirv.arm.tensor<18x34x25xf16> + %0 = spirv.Tosa.Scatter %arg0, %arg1, %arg2 : (!spirv.arm.tensor<18x34x25xf16>, !spirv.arm.tensor<18x20xi32>, !spirv.arm.tensor<18x20x25xf16>) -> !spirv.arm.tensor<18x34x25xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<18x34x25xf16> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<18x34x25xf16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Resize - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @resize_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @resize_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @resize_int, @resize_int_arg_0, @resize_int_res_0 + spirv.ARM.Graph @resize_int(%arg0: !spirv.arm.tensor<1x1x31x55xi8>) -> (!spirv.arm.tensor<1x1x278x55xi8>) { + %0 = spirv.Constant 1 : i32 + %1 = spirv.Constant dense<[16, 1, 9, 1]> : !spirv.arm.tensor<4xi32> + %2 = spirv.Constant dense<0> : !spirv.arm.tensor<2xi32> + %3 = spirv.Constant dense<[0, 7]> : !spirv.arm.tensor<2xi32> // CHECK: {{%.*}} = spirv.Tosa.Resize {{%.*}}, %arg0, {{%.*}}, {{%.*}}, {{%.*}} : (i32, !spirv.arm.tensor<1x1x31x55xi8>, !spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>) -> !spirv.arm.tensor<1x1x278x55xi8> + %4 = spirv.Tosa.Resize %0, %arg0, %1, %2, %3 : (i32, !spirv.arm.tensor<1x1x31x55xi8>, !spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>) -> !spirv.arm.tensor<1x1x278x55xi8> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x1x278x55xi8> + spirv.ARM.GraphOutputs %4 : !spirv.arm.tensor<1x1x278x55xi8> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Resize - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @resize_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @resize_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @resize_fp, @resize_fp_arg_0, @resize_fp_res_0 + spirv.ARM.Graph @resize_fp(%arg0: !spirv.arm.tensor<1x48x33x63xf32>) -> (!spirv.arm.tensor<1x753x297x63xf32>) { + %0 = spirv.Constant 2 : i32 + %1 = spirv.Constant dense<[16, 1, 9, 1]> : !spirv.arm.tensor<4xi32> + %2 = spirv.Constant dense<0> : !spirv.arm.tensor<2xi32> + %3 = spirv.Constant dense<[0, 8]> : !spirv.arm.tensor<2xi32> // CHECK: {{%.*}} = spirv.Tosa.Resize {{%.*}}, %arg0, {{%.*}}, {{%.*}}, {{%.*}} : (i32, !spirv.arm.tensor<1x48x33x63xf32>, !spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>) -> !spirv.arm.tensor<1x753x297x63xf32> + %4 = spirv.Tosa.Resize %0, %arg0, %1, %2, %3 : (i32, !spirv.arm.tensor<1x48x33x63xf32>, !spirv.arm.tensor<4xi32>, !spirv.arm.tensor<2xi32>, !spirv.arm.tensor<2xi32>) -> !spirv.arm.tensor<1x753x297x63xf32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x753x297x63xf32> + spirv.ARM.GraphOutputs %4 : !spirv.arm.tensor<1x753x297x63xf32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Cast - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @cast_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @cast_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @cast_int, @cast_int_arg_0, @cast_int_res_0 + spirv.ARM.Graph @cast_int(%arg0: !spirv.arm.tensor<1x65538x1x2xi8>) -> (!spirv.arm.tensor<1x65538x1x2xi32>) { + // CHECK: {{%.*}} = spirv.Tosa.Cast %arg0 : (!spirv.arm.tensor<1x65538x1x2xi8>) -> !spirv.arm.tensor<1x65538x1x2xi32> + %0 = spirv.Tosa.Cast %arg0 : (!spirv.arm.tensor<1x65538x1x2xi8>) -> !spirv.arm.tensor<1x65538x1x2xi32> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<1x65538x1x2xi32> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<1x65538x1x2xi32> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Cast - PRO-FP +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @cast_fp_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @cast_fp_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @cast_fp, @cast_fp_arg_0, @cast_fp_res_0 + spirv.ARM.Graph @cast_fp(%arg0: !spirv.arm.tensor<11x5x14x4xf32>) -> (!spirv.arm.tensor<11x5x14x4xf16>) { + // CHECK: {{%.*}} = spirv.Tosa.Cast %arg0 : (!spirv.arm.tensor<11x5x14x4xf32>) -> !spirv.arm.tensor<11x5x14x4xf16> + %0 = spirv.Tosa.Cast %arg0 : (!spirv.arm.tensor<11x5x14x4xf32>) -> !spirv.arm.tensor<11x5x14x4xf16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<11x5x14x4xf16> + spirv.ARM.GraphOutputs %0 : !spirv.arm.tensor<11x5x14x4xf16> + } +} + +// ----- + +//===----------------------------------------------------------------------===// +// spirv.TOSA.Rescale - PRO-INT +//===----------------------------------------------------------------------===// + +// CHECK: spirv.module Logical Vulkan requires #spirv.vce +spirv.module Logical Vulkan requires #spirv.vce { + spirv.GlobalVariable @rescale_int_arg_0 bind(0, 0) : !spirv.ptr, UniformConstant> + spirv.GlobalVariable @rescale_int_res_0 bind(1, 0) : !spirv.ptr, UniformConstant> + spirv.ARM.GraphEntryPoint @rescale_int, @rescale_int_arg_0, @rescale_int_res_0 + spirv.ARM.Graph @rescale_int(%arg0: !spirv.arm.tensor<17x29x19xi16>) -> (!spirv.arm.tensor<17x29x19xi16>) { + %0 = spirv.Constant true + %1 = spirv.Constant 3 : i32 + %2 = spirv.Constant false + %3 = spirv.Constant false + %4 = spirv.Constant true + %5 = spirv.Constant dense<1866149760> : !spirv.arm.tensor<1xi32> + %6 = spirv.Constant dense<31> : !spirv.arm.tensor<1xi8> + %7 = spirv.Constant dense<0> : !spirv.arm.tensor<1xi16> + %8 = spirv.Constant dense<0> : !spirv.arm.tensor<1xi16> // CHECK: {{%.*}} = spirv.Tosa.Rescale {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}}, %arg0, {{%.*}}, {{%.*}}, {{%.*}}, {{%.*}} : (i1, i32, i1, i1, i1, !spirv.arm.tensor<17x29x19xi16>, !spirv.arm.tensor<1xi32>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi16>, !spirv.arm.tensor<1xi16>) -> !spirv.arm.tensor<17x29x19xi16> + %9 = spirv.Tosa.Rescale %0, %1, %2, %3, %4, %arg0, %5, %6, %7, %8 : (i1, i32, i1, i1, i1, !spirv.arm.tensor<17x29x19xi16>, !spirv.arm.tensor<1xi32>, !spirv.arm.tensor<1xi8>, !spirv.arm.tensor<1xi16>, !spirv.arm.tensor<1xi16>) -> !spirv.arm.tensor<17x29x19xi16> + // CHECK: spirv.ARM.GraphOutputs {{%.*}} : !spirv.arm.tensor<17x29x19xi16> + spirv.ARM.GraphOutputs %9 : !spirv.arm.tensor<17x29x19xi16> + } +}