Loading mlir/include/mlir/Dialect/SPIRV/SPIRVGLSLOps.td +32 −0 Original line number Diff line number Diff line Loading @@ -200,6 +200,38 @@ def SPV_GLSLCosOp : SPV_GLSLUnaryArithmeticOp<"Cos", 14, SPV_Float16or32> { // ----- def SPV_GLSLSinOp : SPV_GLSLUnaryArithmeticOp<"Sin", 13, SPV_Float16or32> { let summary = "Sine of operand in radians"; let description = [{ The standard trigonometric sine of x radians. The operand x must be a scalar or vector whose component type is 16-bit or 32-bit floating-point. Result Type and the type of x must be the same type. Results are computed per component. ### Custom assembly format ``` restricted-float-scalar-type ::= `f16` | `f32` restricted-float-scalar-vector-type ::= restricted-float-scalar-type | `vector<` integer-literal `x` restricted-float-scalar-type `>` sin-op ::= ssa-id `=` `spv.GLSL.Sin` ssa-use `:` restricted-float-scalar-vector-type ``` For example: ``` %2 = spv.GLSL.Sin %0 : f32 %3 = spv.GLSL.Sin %1 : vector<3xf16> ``` }]; } // ----- def SPV_GLSLExpOp : SPV_GLSLUnaryArithmeticOp<"Exp", 27, SPV_Float16or32> { let summary = "Exponentiation of Operand 1"; Loading mlir/test/Dialect/SPIRV/Serialization/glsl-ops.mlir +4 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,10 @@ spv.module "Logical" "GLSL450" { %1 = spv.GLSL.FMax %arg0, %arg1 : f32 // CHECK: {{%.*}} = spv.GLSL.Sqrt {{%.*}} : f32 %2 = spv.GLSL.Sqrt %arg0 : f32 // CHECK: {{%.*}} = spv.GLSL.Cos {{%.*}} : f32 %3 = spv.GLSL.Cos %arg0 : f32 // CHECK: {{%.*}} = spv.GLSL.Sin {{%.*}} : f32 %4 = spv.GLSL.Sin %arg0 : f32 spv.Return } } mlir/test/Dialect/SPIRV/glslops.mlir +32 −0 Original line number Diff line number Diff line Loading @@ -107,3 +107,35 @@ func @sqrtvec(%arg0 : vector<3xf16>) -> () { %2 = spv.GLSL.Sqrt %arg0 : vector<3xf16> return } //===----------------------------------------------------------------------===// // spv.GLSL.Cos //===----------------------------------------------------------------------===// func @cos(%arg0 : f32) -> () { // CHECK: spv.GLSL.Cos {{%.*}} : f32 %2 = spv.GLSL.Cos %arg0 : f32 return } func @cosvec(%arg0 : vector<3xf16>) -> () { // CHECK: spv.GLSL.Cos {{%.*}} : vector<3xf16> %2 = spv.GLSL.Cos %arg0 : vector<3xf16> return } //===----------------------------------------------------------------------===// // spv.GLSL.Sin //===----------------------------------------------------------------------===// func @sin(%arg0 : f32) -> () { // CHECK: spv.GLSL.Sin {{%.*}} : f32 %2 = spv.GLSL.Sin %arg0 : f32 return } func @sinvec(%arg0 : vector<3xf16>) -> () { // CHECK: spv.GLSL.Sin {{%.*}} : vector<3xf16> %2 = spv.GLSL.Sin %arg0 : vector<3xf16> return } Loading
mlir/include/mlir/Dialect/SPIRV/SPIRVGLSLOps.td +32 −0 Original line number Diff line number Diff line Loading @@ -200,6 +200,38 @@ def SPV_GLSLCosOp : SPV_GLSLUnaryArithmeticOp<"Cos", 14, SPV_Float16or32> { // ----- def SPV_GLSLSinOp : SPV_GLSLUnaryArithmeticOp<"Sin", 13, SPV_Float16or32> { let summary = "Sine of operand in radians"; let description = [{ The standard trigonometric sine of x radians. The operand x must be a scalar or vector whose component type is 16-bit or 32-bit floating-point. Result Type and the type of x must be the same type. Results are computed per component. ### Custom assembly format ``` restricted-float-scalar-type ::= `f16` | `f32` restricted-float-scalar-vector-type ::= restricted-float-scalar-type | `vector<` integer-literal `x` restricted-float-scalar-type `>` sin-op ::= ssa-id `=` `spv.GLSL.Sin` ssa-use `:` restricted-float-scalar-vector-type ``` For example: ``` %2 = spv.GLSL.Sin %0 : f32 %3 = spv.GLSL.Sin %1 : vector<3xf16> ``` }]; } // ----- def SPV_GLSLExpOp : SPV_GLSLUnaryArithmeticOp<"Exp", 27, SPV_Float16or32> { let summary = "Exponentiation of Operand 1"; Loading
mlir/test/Dialect/SPIRV/Serialization/glsl-ops.mlir +4 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,10 @@ spv.module "Logical" "GLSL450" { %1 = spv.GLSL.FMax %arg0, %arg1 : f32 // CHECK: {{%.*}} = spv.GLSL.Sqrt {{%.*}} : f32 %2 = spv.GLSL.Sqrt %arg0 : f32 // CHECK: {{%.*}} = spv.GLSL.Cos {{%.*}} : f32 %3 = spv.GLSL.Cos %arg0 : f32 // CHECK: {{%.*}} = spv.GLSL.Sin {{%.*}} : f32 %4 = spv.GLSL.Sin %arg0 : f32 spv.Return } }
mlir/test/Dialect/SPIRV/glslops.mlir +32 −0 Original line number Diff line number Diff line Loading @@ -107,3 +107,35 @@ func @sqrtvec(%arg0 : vector<3xf16>) -> () { %2 = spv.GLSL.Sqrt %arg0 : vector<3xf16> return } //===----------------------------------------------------------------------===// // spv.GLSL.Cos //===----------------------------------------------------------------------===// func @cos(%arg0 : f32) -> () { // CHECK: spv.GLSL.Cos {{%.*}} : f32 %2 = spv.GLSL.Cos %arg0 : f32 return } func @cosvec(%arg0 : vector<3xf16>) -> () { // CHECK: spv.GLSL.Cos {{%.*}} : vector<3xf16> %2 = spv.GLSL.Cos %arg0 : vector<3xf16> return } //===----------------------------------------------------------------------===// // spv.GLSL.Sin //===----------------------------------------------------------------------===// func @sin(%arg0 : f32) -> () { // CHECK: spv.GLSL.Sin {{%.*}} : f32 %2 = spv.GLSL.Sin %arg0 : f32 return } func @sinvec(%arg0 : vector<3xf16>) -> () { // CHECK: spv.GLSL.Sin {{%.*}} : vector<3xf16> %2 = spv.GLSL.Sin %arg0 : vector<3xf16> return }