From 8f35995af6de5e57628ba70f1ea8b3983dd2df2b Mon Sep 17 00:00:00 2001 From: lin-hitonami Date: Fri, 21 Apr 2023 13:58:54 +0800 Subject: [PATCH] [spirv] Fix generating array type in SPIR-V --- taichi/codegen/spirv/spirv_types.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/taichi/codegen/spirv/spirv_types.cpp b/taichi/codegen/spirv/spirv_types.cpp index e3df76537252a..c47e26824a4f9 100644 --- a/taichi/codegen/spirv/spirv_types.cpp +++ b/taichi/codegen/spirv/spirv_types.cpp @@ -453,9 +453,10 @@ class Translate2Spirv : public TypeVisitor { void visit_array_type(const ArrayType *type) override { SType vt = spir_builder_->get_null_type(); - spir_builder_->declare_global(spv::OpTypeArray, vt, - ir_node_2_spv_value[type->element_type()], - type->get_constant_shape()[0]); + spir_builder_->declare_global( + spv::OpTypeArray, vt, ir_node_2_spv_value[type->element_type()], + spir_builder_->int_immediate_number(spir_builder_->i32_type(), + type->get_constant_shape()[0])); ir_node_2_spv_value[type] = vt.id; spir_builder_->decorate(spv::OpDecorate, vt, spv::DecorationArrayStride, type->memory_alignment_size(layout_context_));