Skip to content

Commit

Permalink
Roll-up of minimal fixes needed to get external-parameter llama model…
Browse files Browse the repository at this point in the history
…s working (iree-org#15523)

Workarounds for iree-org#15522, iree-org#15520.
  • Loading branch information
stellaraccident authored Nov 10, 2023
1 parent 3ef0ea1 commit f66f28f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion compiler/src/iree/compiler/Dialect/Stream/IR/StreamTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ static llvm::cl::opt<bool> clResourceAliasMutableBindings(
llvm::cl::desc(
"Fuses bindings that are mutable instead of leaving them split."),
llvm::cl::init(false));
// TODO(#15522): Change this to discrete once task system scalability limits
// are corrected.
static llvm::cl::opt<IREE::Stream::MemoryModel> clResourceMemoryModel(
"iree-stream-resource-memory-model",
llvm::cl::desc("Memory model used for host-device resource memory access."),
Expand All @@ -78,7 +80,7 @@ static llvm::cl::opt<IREE::Stream::MemoryModel> clResourceMemoryModel(
clEnumValN(IREE::Stream::MemoryModel::Discrete, "discrete",
"Host and device memory are discrete and cross-access is "
"expensive.")),
llvm::cl::init(IREE::Stream::MemoryModel::Discrete));
llvm::cl::init(IREE::Stream::MemoryModel::Unified));

//===----------------------------------------------------------------------===//
// custom<ParameterReference>($scope, $key)
Expand Down
7 changes: 4 additions & 3 deletions runtime/src/iree/io/parameter_index_provider.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,11 @@ static iree_status_t iree_io_parameter_index_provider_load(
IREE_RETURN_AND_END_ZONE_IF_ERROR(
z0, iree_io_parameter_index_provider_resolve(
provider, device, queue_affinity, source_scope, source_key,
target_params.access, &source_entry, &source_file));
IREE_HAL_MEMORY_ACCESS_READ, &source_entry, &source_file));

// Validate the parameter range is in-bounds.
iree_status_t status = iree_io_validate_parameter_range(
target_params.access, source_entry, source_offset, length);
IREE_HAL_MEMORY_ACCESS_READ, source_entry, source_offset, length);

// Try first to reuse the file backing store directly as a buffer. This only
// works with specific file types and with specific target usage. The most
Expand All @@ -265,7 +265,8 @@ static iree_status_t iree_io_parameter_index_provider_load(
{
.host_allocation =
{
.ptr = host_allocation.data,
.ptr = host_allocation.data +
source_entry->storage.file.offset,
},
},
};
Expand Down
3 changes: 2 additions & 1 deletion runtime/src/iree/modules/hal/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,8 @@ IREE_VM_ABI_EXPORT(iree_hal_module_fence_join, //
CrD, r) {
iree_host_size_t fence_count = 0;
iree_hal_fence_t** fences = NULL;
IREE_VM_ABI_VLA_STACK_DEREF_OR_NULL(args, a0_count, a0, iree_hal_fence, 32,
// TODO(#15520): Rework this to avoid the need for a fixed allocation.
IREE_VM_ABI_VLA_STACK_DEREF_OR_NULL(args, a0_count, a0, iree_hal_fence, 349,
&fence_count, &fences);

iree_hal_fence_t* fence = NULL;
Expand Down

0 comments on commit f66f28f

Please sign in to comment.