Skip to content

Vulkan backend bug in casting boolean #8064

@immortalsalomon

Description

@immortalsalomon

Hi all,
I think I found a bug in the Vulkan backend regarding casting from booleans to other types.

The affected file is CodeGen_Vulkan_Dev (https://github.com/halide/Halide/blob/main/src/CodeGen_Vulkan_Dev.cpp) at lines:

SpvId true_value_id = builder.declare_constant(target_type, &true_data);

SpvId false_value_id = builder.declare_constant(target_type, &false_data);

To the declare_constant() method is passed the address of the std::vector object instead of the address of the first element contained by the std::vector. The possible solution I found in line with the code already present is the following (already tested):

    SpvId true_value_id = builder.declare_constant(target_type, &true_data[0]);
    SpvId false_value_id = builder.declare_constant(target_type, &false_data[0]);

Have a nice day :)

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions