Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vulkan] Fixes to address outstanding validation failures #8448

Merged
merged 4 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/CodeGen_Vulkan_Dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1569,6 +1569,7 @@ void CodeGen_Vulkan_Dev::SPIRV_Emitter::visit(const Store *op) {
user_assert(is_const_one(op->predicate)) << "Predicated stores not supported by SPIR-V codegen!\n";

debug(2) << " value_type=" << op->value.type() << " value=" << op->value << "\n";
debug(2) << " index_type=" << op->index.type() << " index=" << op->index << "\n";
op->value.accept(this);
SpvId value_id = builder.current_id();

Expand Down Expand Up @@ -2682,7 +2683,7 @@ void CodeGen_Vulkan_Dev::SPIRV_Emitter::declare_device_args(const Stmt &s, uint3
SpvId runtime_arr_type_id = builder.add_runtime_array(array_element_type_id);

// Annotate the array with its stride
SpvBuilder::Literals array_stride = {(uint32_t)(arg.type.bytes())};
SpvBuilder::Literals array_stride = {(uint32_t)(arg.type.bytes() * lanes)};
builder.add_annotation(runtime_arr_type_id, SpvDecorationArrayStride, array_stride);

// Wrap the runtime array in a struct (required with SPIR-V buffer block semantics)
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/internal/block_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ BlockAllocator *BlockAllocator::create(void *user_context, const Config &cfg, co

void BlockAllocator::destroy(void *user_context, BlockAllocator *instance) {
halide_abort_if_false(user_context, instance != nullptr);
const MemoryAllocators &allocators = instance->allocators;
MemoryAllocators allocators = instance->allocators;
instance->destroy(user_context);
halide_abort_if_false(user_context, allocators.system.deallocate != nullptr);
allocators.system.deallocate(user_context, instance);
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/internal/memory_arena.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ MemoryArena *MemoryArena::create(void *user_context, const Config &cfg, const Sy

void MemoryArena::destroy(void *user_context, MemoryArena *instance) {
halide_debug_assert(user_context, instance != nullptr);
const SystemMemoryAllocatorFns &system_allocator = instance->blocks.current_allocator();
SystemMemoryAllocatorFns system_allocator = instance->blocks.current_allocator();
instance->destroy(user_context);
halide_debug_assert(user_context, system_allocator.deallocate != nullptr);
system_allocator.deallocate(user_context, instance);
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/internal/region_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ RegionAllocator *RegionAllocator::create(void *user_context, BlockResource *bloc

int RegionAllocator::destroy(void *user_context, RegionAllocator *instance) {
halide_abort_if_false(user_context, instance != nullptr);
const MemoryAllocators &allocators = instance->allocators;
MemoryAllocators allocators = instance->allocators;
instance->destroy(user_context);
halide_abort_if_false(user_context, allocators.system.deallocate != nullptr);
allocators.system.deallocate(user_context, instance);
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/internal/string_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ StringStorage *StringStorage::create(void *user_context, const SystemMemoryAlloc

void StringStorage::destroy(void *user_context, StringStorage *instance) {
halide_abort_if_false(user_context, instance != nullptr);
const SystemMemoryAllocatorFns &system_allocator = instance->current_allocator();
SystemMemoryAllocatorFns system_allocator = instance->current_allocator();
instance->destroy(user_context);
halide_abort_if_false(user_context, system_allocator.deallocate != nullptr);
system_allocator.deallocate(user_context, instance);
Expand Down
6 changes: 3 additions & 3 deletions src/runtime/vulkan_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,8 @@ int VulkanMemoryAllocator::destroy(void *user_context, VulkanMemoryAllocator *in
error(user_context) << "VulkanBlockAllocator: Unable to destroy instance! Invalide instance pointer!\n";
return halide_error_code_internal_error;
}
const BlockAllocator::MemoryAllocators &allocators = instance->block_allocator->current_allocators();
BlockAllocator::MemoryAllocators allocators = instance->block_allocator->current_allocators();
instance->destroy(user_context);
BlockAllocator::destroy(user_context, instance->block_allocator);
if (allocators.system.deallocate == nullptr) {
error(user_context) << "VulkanBlockAllocator: Unable to destroy instance! Missing system allocator interface!\n";
return halide_error_code_internal_error;
Expand Down Expand Up @@ -521,7 +520,8 @@ int VulkanMemoryAllocator::destroy(void *user_context) {
<< "user_context=" << user_context << ") ... \n";
#endif
if (block_allocator != nullptr) {
block_allocator->destroy(this);
BlockAllocator::destroy(user_context, block_allocator);
block_allocator = nullptr;
}
region_count = 0;
region_byte_count = 0;
Expand Down
Loading