Changeset View
Changeset View
Standalone View
Standalone View
mlir/test/Dialect/GPU/invalid.mlir
Show All 39 Lines | "gpu.launch_func"(%sz, %sz, %sz, %sz, %sz) | ||||
: (index, index, index, index, index) -> () | : (index, index, index, index, index) -> () | ||||
return | return | ||||
} | } | ||||
// ----- | // ----- | ||||
func @launch_func_missing_parent_module_attribute(%sz : index) { | func @launch_func_missing_parent_module_attribute(%sz : index) { | ||||
// expected-error@+1 {{expected the closest surrounding module to have the 'gpu.container_module' attribute}} | // expected-error@+1 {{expected the closest surrounding module to have the 'gpu.container_module' attribute}} | ||||
"gpu.launch_func"(%sz, %sz, %sz, %sz, %sz, %sz) {foo = "bar"} | gpu.launch_func @foo::@bar blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) | ||||
: (index, index, index, index, index, index) -> () | |||||
return | return | ||||
} | } | ||||
// ----- | // ----- | ||||
module attributes {gpu.container_module} { | module attributes {gpu.container_module} { | ||||
func @launch_func_missing_callee_attribute(%sz : index) { | func @launch_func_missing_callee_attribute(%sz : index) { | ||||
// expected-error@+1 {{symbol reference attribute 'kernel' must be specified}} | // expected-error@+1 {{'gpu.launch_func' op requires attribute 'kernel'}} | ||||
"gpu.launch_func"(%sz, %sz, %sz, %sz, %sz, %sz) {foo = "bar"} | "gpu.launch_func"(%sz, %sz, %sz, %sz, %sz, %sz) | ||||
: (index, index, index, index, index, index) -> () | : (index, index, index, index, index, index) -> () | ||||
return | return | ||||
} | } | ||||
} | } | ||||
// ----- | // ----- | ||||
module attributes {gpu.container_module} { | module attributes {gpu.container_module} { | ||||
func @launch_func_no_function_attribute(%sz : index) { | func @launch_func_no_function_attribute(%sz : index) { | ||||
// expected-error@+1 {{symbol reference attribute 'kernel' must be specified}} | // expected-error@+1 {{custom op 'gpu.launch_func' invalid kind of attribute specified}} | ||||
"gpu.launch_func"(%sz, %sz, %sz, %sz, %sz, %sz) {kernel = 10} | gpu.launch_func "foo" blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) | ||||
: (index, index, index, index, index, index) -> () | |||||
return | return | ||||
} | } | ||||
} | } | ||||
// ----- | // ----- | ||||
module attributes {gpu.container_module} { | module attributes {gpu.container_module} { | ||||
func @launch_func_undefined_module(%sz : index) { | func @launch_func_undefined_module(%sz : index) { | ||||
// expected-error@+1 {{kernel module 'kernels' is undefined}} | // expected-error@+1 {{kernel module 'kernels' is undefined}} | ||||
"gpu.launch_func"(%sz, %sz, %sz, %sz, %sz, %sz) | gpu.launch_func @kernels::@kernel_1 blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) | ||||
{ kernel = @kernels::@kernel_1 } | |||||
: (index, index, index, index, index, index) -> () | |||||
return | return | ||||
} | } | ||||
} | } | ||||
// ----- | // ----- | ||||
module attributes {gpu.container_module} { | module attributes {gpu.container_module} { | ||||
module @kernels { | module @kernels { | ||||
// expected-error@+1 {{'gpu.func' op expects parent op 'gpu.module'}} | // expected-error@+1 {{'gpu.func' op expects parent op 'gpu.module'}} | ||||
gpu.func @kernel_1(%arg1 : !llvm.ptr<float>) { | gpu.func @kernel_1(%arg1 : !llvm.ptr<float>) { | ||||
gpu.return | gpu.return | ||||
} | } | ||||
} | } | ||||
} | } | ||||
// ----- | // ----- | ||||
module attributes {gpu.container_module} { | module attributes {gpu.container_module} { | ||||
module @kernels { | module @kernels { | ||||
} | } | ||||
func @launch_func_missing_module_attribute(%sz : index) { | func @launch_func_missing_module_attribute(%sz : index) { | ||||
// expected-error@+1 {{kernel module 'kernels' is undefined}} | // expected-error@+1 {{kernel module 'kernels' is undefined}} | ||||
"gpu.launch_func"(%sz, %sz, %sz, %sz, %sz, %sz) | gpu.launch_func @kernels::@kernel_1 blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) | ||||
{ kernel = @kernels::@kernel_1 } | |||||
: (index, index, index, index, index, index) -> () | |||||
return | return | ||||
} | } | ||||
} | } | ||||
// ----- | // ----- | ||||
module attributes {gpu.container_module} { | module attributes {gpu.container_module} { | ||||
gpu.module @kernels { } | gpu.module @kernels { } | ||||
func @launch_func_undefined_function(%sz : index) { | func @launch_func_undefined_function(%sz : index) { | ||||
// expected-error@+1 {{kernel function '@kernels::@kernel_1' is undefined}} | // expected-error@+1 {{kernel function '@kernels::@kernel_1' is undefined}} | ||||
"gpu.launch_func"(%sz, %sz, %sz, %sz, %sz, %sz) | gpu.launch_func @kernels::@kernel_1 blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) | ||||
{ kernel = @kernels::@kernel_1 } | |||||
: (index, index, index, index, index, index) -> () | |||||
return | return | ||||
} | } | ||||
} | } | ||||
// ----- | // ----- | ||||
module attributes {gpu.container_module} { | module attributes {gpu.container_module} { | ||||
module @kernels { | module @kernels { | ||||
gpu.func @kernel_1(%arg1 : !llvm.ptr<float>) kernel { | gpu.func @kernel_1(%arg1 : !llvm.ptr<float>) kernel { | ||||
gpu.return | gpu.return | ||||
} | } | ||||
} | } | ||||
func @launch_func_missing_kernel_attr(%sz : index, %arg : !llvm.ptr<float>) { | func @launch_func_missing_kernel_attr(%sz : index, %arg : !llvm.ptr<float>) { | ||||
// expected-error@+1 {{kernel module 'kernels' is undefined}} | // expected-error@+1 {{kernel module 'kernels' is undefined}} | ||||
"gpu.launch_func"(%sz, %sz, %sz, %sz, %sz, %sz, %arg) | gpu.launch_func @kernels::@kernel_1 blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) args(%arg : !llvm.ptr<float>) | ||||
{kernel = @kernels::@kernel_1} | |||||
: (index, index, index, index, index, index, !llvm.ptr<float>) -> () | |||||
return | return | ||||
} | } | ||||
} | } | ||||
// ----- | // ----- | ||||
module attributes {gpu.container_module} { | module attributes {gpu.container_module} { | ||||
gpu.module @kernels { | gpu.module @kernels { | ||||
gpu.func @kernel_1(%arg1 : !llvm.ptr<float>) { | gpu.func @kernel_1(%arg1 : !llvm.ptr<float>) { | ||||
gpu.return | gpu.return | ||||
} | } | ||||
} | } | ||||
func @launch_func_missing_kernel_attr(%sz : index, %arg : !llvm.ptr<float>) { | func @launch_func_missing_kernel_attr(%sz : index, %arg : !llvm.ptr<float>) { | ||||
// expected-error@+1 {{kernel function is missing the 'gpu.kernel' attribute}} | // expected-error@+1 {{kernel function is missing the 'gpu.kernel' attribute}} | ||||
"gpu.launch_func"(%sz, %sz, %sz, %sz, %sz, %sz, %arg) | gpu.launch_func @kernels::@kernel_1 blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) args(%arg : !llvm.ptr<float>) | ||||
{kernel = @kernels::@kernel_1} | |||||
: (index, index, index, index, index, index, !llvm.ptr<float>) -> () | |||||
return | return | ||||
} | } | ||||
} | } | ||||
// ----- | // ----- | ||||
module attributes {gpu.container_module} { | module attributes {gpu.container_module} { | ||||
gpu.module @kernels { | gpu.module @kernels { | ||||
gpu.func @kernel_1(%arg1 : !llvm.ptr<float>) kernel { | gpu.func @kernel_1(%arg1 : !llvm.ptr<float>) kernel { | ||||
gpu.return | gpu.return | ||||
} | } | ||||
} | } | ||||
func @launch_func_kernel_operand_size(%sz : index, %arg : !llvm.ptr<float>) { | func @launch_func_kernel_operand_size(%sz : index, %arg : !llvm.ptr<float>) { | ||||
// expected-error@+1 {{got 2 kernel operands but expected 1}} | // expected-error@+1 {{got 2 kernel operands but expected 1}} | ||||
"gpu.launch_func"(%sz, %sz, %sz, %sz, %sz, %sz, %arg, %arg) | gpu.launch_func @kernels::@kernel_1 blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) args(%arg : !llvm.ptr<float>, %arg : !llvm.ptr<float>) | ||||
{kernel = @kernels::@kernel_1} | |||||
: (index, index, index, index, index, index, !llvm.ptr<float>, | |||||
!llvm.ptr<float>) -> () | |||||
return | return | ||||
} | } | ||||
} | } | ||||
// ----- | // ----- | ||||
module attributes {gpu.container_module} { | module attributes {gpu.container_module} { | ||||
gpu.module @kernels { | gpu.module @kernels { | ||||
gpu.func @kernel_1(%arg1 : f32) kernel { | gpu.func @kernel_1(%arg1 : f32) kernel { | ||||
gpu.return | gpu.return | ||||
} | } | ||||
} | } | ||||
func @launch_func_kernel_operand_types(%sz : index, %arg : f32) { | func @launch_func_kernel_operand_types(%sz : index, %arg : f32) { | ||||
// expected-err@+1 {{type of function argument 0 does not match}} | // expected-err@+1 {{type of function argument 0 does not match}} | ||||
"gpu.launch_func"(%sz, %sz, %sz, %sz, %sz, %sz, %arg) | gpu.launch_func @kernels::@kernel_1 blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) args(%arg : f32) | ||||
{kernel = @kernels::@kernel_1} | return | ||||
: (index, index, index, index, index, index, f32) -> () | } | ||||
} | |||||
// ----- | |||||
module attributes {gpu.container_module} { | |||||
func @launch_func_kernel_operand_attr(%sz : index) { | |||||
// expected-error@+1 {{does not support kernel argument attributes}} | |||||
gpu.launch_func @foo::@bar blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) args(%sz : index {foo}) | |||||
return | return | ||||
} | } | ||||
} | } | ||||
// ----- | // ----- | ||||
func @illegal_dimension() { | func @illegal_dimension() { | ||||
// expected-error@+1 {{dimension "o" is invalid}} | // expected-error@+1 {{dimension "o" is invalid}} | ||||
▲ Show 20 Lines • Show All 248 Lines • Show Last 20 Lines |