|
1 | | -// RUN: mlir-translate --no-implicit-module --split-input-file --test-spirv-roundtrip %s | FileCheck %s |
2 | | -// RUN: %if spirv-tools %{ mlir-translate -no-implicit-module --split-input-file -serialize-spirv %s | spirv-val %} |
| 1 | +// RUN: mlir-translate --no-implicit-module --test-spirv-roundtrip %s | FileCheck %s |
| 2 | +// RUN: %if spirv-tools %{ mlir-translate --no-implicit-module --serialize-spirv %s | spirv-val %} |
3 | 3 |
|
4 | | -spirv.module Logical Vulkan requires #spirv.vce<v1.3, [VulkanMemoryModel, Shader, Int64, Int16, Int8, Float64, Float16, CooperativeMatrixKHR], [SPV_KHR_vulkan_memory_model, SPV_KHR_cooperative_matrix]> { |
| 4 | +// Note: Since the output of this test (optionally) gets validated by spirv-val, |
| 5 | +// we cannot use splits. |
| 6 | + |
| 7 | +spirv.module Logical Vulkan requires #spirv.vce<v1.3, |
| 8 | + [VulkanMemoryModel, Shader, Int64, Int16, Int8, Float64, Float16, CooperativeMatrixKHR, TensorsARM, Linkage], |
| 9 | + [SPV_KHR_vulkan_memory_model, SPV_KHR_cooperative_matrix, SPV_ARM_tensors]> { |
5 | 10 | // CHECK-LABEL: @bool_const |
6 | 11 | spirv.func @bool_const() -> () "None" { |
7 | 12 | // CHECK: spirv.Constant true |
@@ -307,178 +312,5 @@ spirv.module Logical Vulkan requires #spirv.vce<v1.3, [VulkanMemoryModel, Shader |
307 | 312 | spirv.ReturnValue %coop : !spirv.coopmatrix<16x16xi8, Subgroup, MatrixAcc> |
308 | 313 | } |
309 | 314 |
|
310 | | - // CHECK-LABEL: @arm_tensor_of_i32 |
311 | | - spirv.func @arm_tensor_of_i32() -> (!spirv.arm.tensor<2x3xi32>) "None" { |
312 | | - // CHECK: {{%.*}} = spirv.Constant dense<{{\[}}[1, 2, 3], [4, 5, 6]]> : !spirv.arm.tensor<2x3xi32> |
313 | | - %0 = spirv.Constant dense<[[1, 2, 3], [4, 5, 6]]> : !spirv.arm.tensor<2x3xi32> |
314 | | - spirv.ReturnValue %0 : !spirv.arm.tensor<2x3xi32> |
315 | | - } |
316 | | - |
317 | | - // CHECK-LABEL: @splat_arm_tensor_of_i32 |
318 | | - spirv.func @splat_arm_tensor_of_i32() -> (!spirv.arm.tensor<2x3xi32>) "None" { |
319 | | - // CHECK: {{%.*}} = spirv.Constant dense<2> : !spirv.arm.tensor<2x3xi32> |
320 | | - %0 = spirv.Constant dense<2> : !spirv.arm.tensor<2x3xi32> |
321 | | - spirv.ReturnValue %0 : !spirv.arm.tensor<2x3xi32> |
322 | | - } |
323 | | - |
324 | | - // CHECK-LABEL: @arm_tensor_of_f32 |
325 | | - spirv.func @arm_tensor_of_f32() -> (!spirv.arm.tensor<2x3xf32>) "None" { |
326 | | - // CHECK: {{%.*}} = spirv.Constant dense<{{\[}}[1.000000e+00, 2.000000e+00, 3.000000e+00], [4.000000e+00, 5.000000e+00, 6.000000e+00]]> : !spirv.arm.tensor<2x3xf32> |
327 | | - %0 = spirv.Constant dense<[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]>: !spirv.arm.tensor<2x3xf32> |
328 | | - spirv.ReturnValue %0 : !spirv.arm.tensor<2x3xf32> |
329 | | - } |
330 | | - |
331 | | - // CHECK-LABEL: @splat_arm_tensor_of_f32 |
332 | | - spirv.func @splat_arm_tensor_of_f32() -> (!spirv.arm.tensor<2x3xf32>) "None" { |
333 | | - // CHECK: {{%.*}} = spirv.Constant dense<2.000000e+00> : !spirv.arm.tensor<2x3xf32> |
334 | | - %0 = spirv.Constant dense<2.0> : !spirv.arm.tensor<2x3xf32> |
335 | | - spirv.ReturnValue %0 : !spirv.arm.tensor<2x3xf32> |
336 | | - } |
337 | | - |
338 | | - // CHECK-LABEL: @null_arm_tensor_of_i32 |
339 | | - spirv.func @null_arm_tensor_of_i32() -> (!spirv.arm.tensor<2x3xi32>) "None" { |
340 | | - // CHECK: spirv.Constant dense<0> : !spirv.arm.tensor<2x3xi32> |
341 | | - %0 = spirv.Constant dense<0> : !spirv.arm.tensor<2x3xi32> |
342 | | - spirv.ReturnValue %0 : !spirv.arm.tensor<2x3xi32> |
343 | | - } |
344 | | - |
345 | | - // CHECK-LABEL: @null_arm_tensor_of_f32 |
346 | | - spirv.func @null_arm_tensor_of_f32() -> (!spirv.arm.tensor<2x3xf32>) "None" { |
347 | | - // CHECK: spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<2x3xf32> |
348 | | - %0 = spirv.Constant dense<0.0> : !spirv.arm.tensor<2x3xf32> |
349 | | - spirv.ReturnValue %0 : !spirv.arm.tensor<2x3xf32> |
350 | | - } |
351 | | - |
352 | 315 | spirv.EntryPoint "GLCompute" @bool_const |
353 | 316 | } |
354 | | - |
355 | | -// ----- |
356 | | - |
357 | | -spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader, ReplicatedCompositesEXT], [SPV_EXT_replicated_composites]> { |
358 | | - |
359 | | - // CHECK-LABEL: @splat_vector_i32 |
360 | | - spirv.func @splat_vector_i32() -> (vector<3xi32>) "None" { |
361 | | - // CHECK: spirv.EXT.ConstantCompositeReplicate [1 : i32] : vector<3xi32> |
362 | | - %1 = spirv.EXT.ConstantCompositeReplicate [1 : i32] : vector<3xi32> |
363 | | - spirv.ReturnValue %1 : vector<3xi32> |
364 | | - } |
365 | | - |
366 | | - // CHECK-LABEL: @splat_array_of_i32 |
367 | | - spirv.func @splat_array_of_i32() -> (!spirv.array<3 x i32>) "None" { |
368 | | - // CHECK: spirv.EXT.ConstantCompositeReplicate [1 : i32] : !spirv.array<3 x i32> |
369 | | - %1 = spirv.EXT.ConstantCompositeReplicate [1 : i32] : !spirv.array<3 x i32> |
370 | | - spirv.ReturnValue %1 : !spirv.array<3 x i32> |
371 | | - } |
372 | | - |
373 | | - // CHECK-LABEL: @splat_array_of_vectors_of_i32 |
374 | | - spirv.func @splat_array_of_vectors_of_i32() -> (!spirv.array<3 x vector<2xi32>>) "None" { |
375 | | - // CHECK: spirv.EXT.ConstantCompositeReplicate [dense<[1, 2]> : vector<2xi32>] : !spirv.array<3 x vector<2xi32>> |
376 | | - %0 = spirv.EXT.ConstantCompositeReplicate [dense<[1, 2]> : vector<2xi32>] : !spirv.array<3 x vector<2xi32>> |
377 | | - spirv.ReturnValue %0 : !spirv.array<3 x vector<2xi32>> |
378 | | - } |
379 | | - |
380 | | - // CHECK-LABEL: @splat_array_of_splat_array_of_i32 |
381 | | - spirv.func @splat_array_of_splat_array_of_i32() -> (!spirv.array<2 x !spirv.array<3 x i32>>) "None" { |
382 | | - // CHECK: %0 = spirv.EXT.ConstantCompositeReplicate [3 : i32] : !spirv.array<2 x !spirv.array<3 x i32>> |
383 | | - %0 = spirv.EXT.ConstantCompositeReplicate [3 : i32] : !spirv.array<2 x !spirv.array<3 x i32>> |
384 | | - spirv.ReturnValue %0 : !spirv.array<2 x !spirv.array<3 x i32>> |
385 | | - } |
386 | | - |
387 | | - // CHECK-LABEL: @splat_array_of_non_splat_array_of_i32 |
388 | | - spirv.func @splat_array_of_non_splat_array_of_i32() -> (!spirv.array<2 x !spirv.array<3 x i32>>) "None" { |
389 | | - // CHECK: %0 = spirv.EXT.ConstantCompositeReplicate {{\[}}[1 : i32, 2 : i32, 3 : i32]] : !spirv.array<2 x !spirv.array<3 x i32>> |
390 | | - %0 = spirv.EXT.ConstantCompositeReplicate [[1 : i32, 2 : i32, 3 : i32]] : !spirv.array<2 x !spirv.array<3 x i32>> |
391 | | - spirv.ReturnValue %0 : !spirv.array<2 x !spirv.array<3 x i32>> |
392 | | - } |
393 | | - |
394 | | - // CHECK-LABEL: @splat_array_of_splat_vectors_of_i32 |
395 | | - spirv.func @splat_array_of_splat_vectors_of_i32() -> (!spirv.array<2 x vector<2xi32>>) "None" { |
396 | | - // CHECK: spirv.EXT.ConstantCompositeReplicate [2 : i32] : !spirv.array<2 x vector<2xi32>> |
397 | | - %0 = spirv.EXT.ConstantCompositeReplicate [2 : i32] : !spirv.array<2 x vector<2xi32>> |
398 | | - spirv.ReturnValue %0 : !spirv.array<2 x vector<2xi32>> |
399 | | - } |
400 | | - |
401 | | - // CHECK-LABEL: @splat_arm_tensor_of_i32 |
402 | | - spirv.func @splat_arm_tensor_of_i32() -> (!spirv.arm.tensor<2x3xi32>) "None" { |
403 | | - // CHECK: spirv.EXT.ConstantCompositeReplicate [2 : i32] : !spirv.arm.tensor<2x3xi32> |
404 | | - %0 = spirv.EXT.ConstantCompositeReplicate [2 : i32] : !spirv.arm.tensor<2x3xi32> |
405 | | - spirv.ReturnValue %0 : !spirv.arm.tensor<2x3xi32> |
406 | | - } |
407 | | - |
408 | | - // CHECK-LABEL: @splat_array_of_non_splat_array_of_arrays_of_i32 |
409 | | - spirv.func @splat_array_of_non_splat_array_of_arrays_of_i32() -> !spirv.array<2 x !spirv.array<2 x !spirv.array<3 x i32>>> "None" { |
410 | | - // CHECK: spirv.EXT.ConstantCompositeReplicate {{\[}}{{\[}}[1 : i32, 2 : i32, 3 : i32], [4 : i32, 5 : i32, 6 : i32]]] : !spirv.array<2 x !spirv.array<2 x !spirv.array<3 x i32>>> |
411 | | - %0 = spirv.EXT.ConstantCompositeReplicate [[[1 : i32, 2 : i32, 3 : i32], [4 : i32, 5 : i32, 6 : i32]]] : !spirv.array<2 x !spirv.array<2 x !spirv.array<3 x i32>>> |
412 | | - spirv.ReturnValue %0 : !spirv.array<2 x !spirv.array<2 x !spirv.array<3 x i32>>> |
413 | | - } |
414 | | - |
415 | | - // CHECK-LABEL: @null_cc_arm_tensor_of_i32 |
416 | | - spirv.func @null_cc_arm_tensor_of_i32() -> (!spirv.arm.tensor<2x3xi32>) "None" { |
417 | | - // CHECK: spirv.Constant dense<0> : !spirv.arm.tensor<2x3xi32> |
418 | | - %0 = spirv.EXT.ConstantCompositeReplicate [0 : i32] : !spirv.arm.tensor<2x3xi32> |
419 | | - spirv.ReturnValue %0 : !spirv.arm.tensor<2x3xi32> |
420 | | - } |
421 | | - |
422 | | - // CHECK-LABEL: @splat_vector_f32 |
423 | | - spirv.func @splat_vector_f32() -> (vector<3xf32>) "None" { |
424 | | - // CHECK: spirv.EXT.ConstantCompositeReplicate [1.000000e+00 : f32] : vector<3xf32> |
425 | | - %1 = spirv.EXT.ConstantCompositeReplicate [1.0 : f32] : vector<3xf32> |
426 | | - spirv.ReturnValue %1 : vector<3xf32> |
427 | | - } |
428 | | - |
429 | | - // CHECK-LABEL: @splat_array_of_f32 |
430 | | - spirv.func @splat_array_of_f32() -> (!spirv.array<3 x f32>) "None" { |
431 | | - // CHECK: spirv.EXT.ConstantCompositeReplicate [1.000000e+00 : f32] : !spirv.array<3 x f32> |
432 | | - %1 = spirv.EXT.ConstantCompositeReplicate [1.0 : f32] : !spirv.array<3 x f32> |
433 | | - spirv.ReturnValue %1 : !spirv.array<3 x f32> |
434 | | - } |
435 | | - |
436 | | - // CHECK-LABEL: @splat_array_of_splat_array_of_f32 |
437 | | - spirv.func @splat_array_of_splat_array_of_f32() -> (!spirv.array<2 x !spirv.array<3 x f32>>) "None" { |
438 | | - // CHECK: %0 = spirv.EXT.ConstantCompositeReplicate [3.000000e+00 : f32] : !spirv.array<2 x !spirv.array<3 x f32>> |
439 | | - %0 = spirv.EXT.ConstantCompositeReplicate [3.0 : f32] : !spirv.array<2 x !spirv.array<3 x f32>> |
440 | | - spirv.ReturnValue %0 : !spirv.array<2 x !spirv.array<3 x f32>> |
441 | | - } |
442 | | - |
443 | | - // CHECK-LABEL: @splat_array_of_non_splat_array_of_f32 |
444 | | - spirv.func @splat_array_of_non_splat_array_of_f32() -> (!spirv.array<2 x !spirv.array<3 x f32>>) "None" { |
445 | | - // CHECK: %0 = spirv.EXT.ConstantCompositeReplicate {{\[}}[1.000000e+00 : f32, 2.000000e+00 : f32, 3.000000e+00 : f32]] : !spirv.array<2 x !spirv.array<3 x f32>> |
446 | | - %0 = spirv.EXT.ConstantCompositeReplicate [[1.0 : f32, 2.0 : f32, 3.0 : f32]] : !spirv.array<2 x !spirv.array<3 x f32>> |
447 | | - spirv.ReturnValue %0 : !spirv.array<2 x !spirv.array<3 x f32>> |
448 | | - } |
449 | | - |
450 | | - // CHECK-LABEL: @splat_array_of_vectors_of_f32 |
451 | | - spirv.func @splat_array_of_vectors_of_f32() -> (!spirv.array<3 x vector<2xf32>>) "None" { |
452 | | - // CHECK: spirv.EXT.ConstantCompositeReplicate [dense<[1.000000e+00, 2.000000e+00]> : vector<2xf32>] : !spirv.array<3 x vector<2xf32>> |
453 | | - %0 = spirv.EXT.ConstantCompositeReplicate [dense<[1.0, 2.0]> : vector<2xf32>] : !spirv.array<3 x vector<2xf32>> |
454 | | - spirv.ReturnValue %0 : !spirv.array<3 x vector<2xf32>> |
455 | | - } |
456 | | - |
457 | | - // CHECK-LABEL: @splat_array_of_splat_vectors_of_f32 |
458 | | - spirv.func @splat_array_of_splat_vectors_of_f32() -> (!spirv.array<2 x vector<2xf32>>) "None" { |
459 | | - // CHECK: spirv.EXT.ConstantCompositeReplicate [2.000000e+00 : f32] : !spirv.array<2 x vector<2xf32>> |
460 | | - %0 = spirv.EXT.ConstantCompositeReplicate [2.0 : f32] : !spirv.array<2 x vector<2xf32>> |
461 | | - spirv.ReturnValue %0 : !spirv.array<2 x vector<2xf32>> |
462 | | - } |
463 | | - |
464 | | - // CHECK-LABEL: @splat_arm_tensor_of_f32 |
465 | | - spirv.func @splat_arm_tensor_of_f32() -> (!spirv.arm.tensor<2x3xf32>) "None" { |
466 | | - // CHECK: spirv.EXT.ConstantCompositeReplicate [2.000000e+00 : f32] : !spirv.arm.tensor<2x3xf32> |
467 | | - %0 = spirv.EXT.ConstantCompositeReplicate [2.0 : f32] : !spirv.arm.tensor<2x3xf32> |
468 | | - spirv.ReturnValue %0 : !spirv.arm.tensor<2x3xf32> |
469 | | - } |
470 | | - |
471 | | - // CHECK-LABEL: @splat_array_of_non_splat_array_of_arrays_of_f32 |
472 | | - spirv.func @splat_array_of_non_splat_array_of_arrays_of_f32() -> !spirv.array<2 x !spirv.array<2 x !spirv.array<3 x f32>>> "None" { |
473 | | - // CHECK: spirv.EXT.ConstantCompositeReplicate {{\[}}{{\[}}[1.000000e+00 : f32, 2.000000e+00 : f32, 3.000000e+00 : f32], [4.000000e+00 : f32, 5.000000e+00 : f32, 6.000000e+00 : f32]]] : !spirv.array<2 x !spirv.array<2 x !spirv.array<3 x f32>>> |
474 | | - %0 = spirv.EXT.ConstantCompositeReplicate [[[1.0 : f32, 2.0 : f32, 3.0 : f32], [4.0 : f32, 5.0 : f32, 6.0 : f32]]] : !spirv.array<2 x !spirv.array<2 x !spirv.array<3 x f32>>> |
475 | | - spirv.ReturnValue %0 : !spirv.array<2 x !spirv.array<2 x !spirv.array<3 x f32>>> |
476 | | - } |
477 | | - |
478 | | - // CHECK-LABEL: @null_cc_arm_tensor_of_f32 |
479 | | - spirv.func @null_cc_arm_tensor_of_f32() -> (!spirv.arm.tensor<2x3xf32>) "None" { |
480 | | - // CHECK: spirv.Constant dense<0.000000e+00> : !spirv.arm.tensor<2x3xf32> |
481 | | - %0 = spirv.EXT.ConstantCompositeReplicate [0.0 : f32] : !spirv.arm.tensor<2x3xf32> |
482 | | - spirv.ReturnValue %0 : !spirv.arm.tensor<2x3xf32> |
483 | | - } |
484 | | -} |
0 commit comments