Skip to content

Commit

Permalink
Renaming rocm executable -> hip executable.
Browse files Browse the repository at this point in the history
  • Loading branch information
benvanik committed Aug 14, 2024
1 parent c2fc7d8 commit edc6428
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 53 deletions.
2 changes: 1 addition & 1 deletion compiler/plugins/target/ROCM/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ iree_compiler_cc_library(
"//compiler/src/iree/compiler/PluginAPI",
"//compiler/src/iree/compiler/Utils",
"//runtime/src/iree/schemas:executable_debug_info_c_fbs",
"//runtime/src/iree/schemas:rocm_executable_def_c_fbs",
"//runtime/src/iree/schemas:hip_executable_def_c_fbs",
"@llvm-project//llvm:AMDGPUCodeGen",
"@llvm-project//llvm:Analysis",
"@llvm-project//llvm:BitWriter",
Expand Down
2 changes: 1 addition & 1 deletion compiler/plugins/target/ROCM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ iree_cc_library(
iree::compiler::PluginAPI
iree::compiler::Utils
iree::schemas::executable_debug_info_c_fbs
iree::schemas::rocm_executable_def_c_fbs
iree::schemas::hip_executable_def_c_fbs
PUBLIC
)

Expand Down
30 changes: 15 additions & 15 deletions compiler/plugins/target/ROCM/ROCMTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "iree/compiler/Utils/FlatbufferUtils.h"
#include "iree/compiler/Utils/ModuleUtils.h"
#include "iree/compiler/Utils/ToolUtils.h"
#include "iree/schemas/rocm_executable_def_builder.h"
#include "iree/schemas/hip_executable_def_builder.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Analysis/TargetTransformInfo.h"
Expand Down Expand Up @@ -573,7 +573,7 @@ class ROCMTargetBackend final : public TargetBackend {
}

iree_compiler::FlatbufferBuilder builder;
iree_hal_rocm_ExecutableDef_start_as_root(builder);
iree_hal_hip_ExecutableDef_start_as_root(builder);

// Attach embedded source file contents.
auto sourceFilesRef = createSourceFilesVec(
Expand Down Expand Up @@ -638,35 +638,35 @@ class ROCMTargetBackend final : public TargetBackend {
targetHSACO.size());

auto entryPointsRef = builder.createStringVec(entryPointNames);
iree_hal_rocm_BlockSize_vec_start(builder);
iree_hal_hip_BlockSize_vec_start(builder);
auto blockSizes = workgroupSizes.begin();
for (int i = 0, e = entryPointNames.size(); i < e; ++i) {
iree_hal_rocm_BlockSize_vec_push_create(
iree_hal_hip_BlockSize_vec_push_create(
builder, (*blockSizes)[0], (*blockSizes)[1], (*blockSizes)[2]);
++blockSizes;
}
auto workgroupLocalMemoriesRef =
builder.createInt32Vec(workgroupLocalMemories);
auto blockSizesRef = iree_hal_rocm_BlockSize_vec_end(builder);
iree_hal_rocm_ExecutableDef_entry_points_add(builder, entryPointsRef);
iree_hal_rocm_ExecutableDef_block_sizes_add(builder, blockSizesRef);
iree_hal_rocm_ExecutableDef_shared_memory_sizes_add(
auto blockSizesRef = iree_hal_hip_BlockSize_vec_end(builder);
iree_hal_hip_ExecutableDef_entry_points_add(builder, entryPointsRef);
iree_hal_hip_ExecutableDef_block_sizes_add(builder, blockSizesRef);
iree_hal_hip_ExecutableDef_shared_memory_sizes_add(
builder, workgroupLocalMemoriesRef);
iree_hal_rocm_ExecutableDef_hsaco_image_add(builder, hsacoRef);
iree_hal_hip_ExecutableDef_hsaco_image_add(builder, hsacoRef);
if (!sourceLocationRefs.empty()) {
auto sourceLocationsRef =
builder.createOffsetVecDestructive(sourceLocationRefs);
iree_hal_rocm_ExecutableDef_source_locations_add(builder,
sourceLocationsRef);
iree_hal_hip_ExecutableDef_source_locations_add(builder,
sourceLocationsRef);
}
if (!stageLocationsRefs.empty()) {
auto stageLocationsRef =
builder.createOffsetVecDestructive(stageLocationsRefs);
iree_hal_rocm_ExecutableDef_stage_locations_add(builder,
stageLocationsRef);
iree_hal_hip_ExecutableDef_stage_locations_add(builder,
stageLocationsRef);
}
iree_hal_rocm_ExecutableDef_source_files_add(builder, sourceFilesRef);
iree_hal_rocm_ExecutableDef_end_as_root(builder);
iree_hal_hip_ExecutableDef_source_files_add(builder, sourceFilesRef);
iree_hal_hip_ExecutableDef_end_as_root(builder);

// Add the binary data to the target executable.
executableBuilder.create<iree_compiler::IREE::HAL::ExecutableBinaryOp>(
Expand Down
2 changes: 1 addition & 1 deletion experimental/webgpu/executable.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ iree_status_t iree_hal_webgpu_executable_create(

// Publish any embedded source files to the tracing infrastructure.
iree_hal_debug_publish_source_files(
iree_hal_rocm_ExecutableDef_source_files_get(executable_def));
iree_hal_hip_ExecutableDef_source_files_get(executable_def));

// Create one pipeline per entry point.
flatbuffers_uint32_vec_t entry_points_vec =
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/iree/hal/drivers/hip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ iree_cc_library(
iree::hal::utils::resource_set
iree::hal::utils::semaphore_base
iree::schemas::executable_debug_info_c_fbs
iree::schemas::rocm_executable_def_c_fbs
iree::schemas::hip_executable_def_c_fbs
PUBLIC
)

Expand Down
42 changes: 21 additions & 21 deletions runtime/src/iree/hal/drivers/hip/native_executable.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#include "iree/base/internal/flatcc/parsing.h"
#include "iree/schemas/executable_debug_info_reader.h"
#include "iree/schemas/executable_debug_info_verifier.h"
#include "iree/schemas/rocm_executable_def_reader.h"
#include "iree/schemas/rocm_executable_def_verifier.h"
#include "iree/schemas/hip_executable_def_reader.h"
#include "iree/schemas/hip_executable_def_verifier.h"

typedef struct iree_hal_hip_native_executable_t {
// Abstract resource used for injecting reference counting and vtable;
Expand Down Expand Up @@ -64,19 +64,19 @@ static iree_status_t iree_hal_hip_native_executable_flatbuffer_verify(
// Run flatcc generated verification. This ensures all pointers are in-bounds
// and that we can safely walk the file, but not that the actual contents of
// the flatbuffer meet our expectations.
int verify_ret = iree_hal_rocm_ExecutableDef_verify_as_root(
int verify_ret = iree_hal_hip_ExecutableDef_verify_as_root(
flatbuffer_data.data, flatbuffer_data.data_length);
if (verify_ret != flatcc_verify_ok) {
return iree_make_status(IREE_STATUS_INVALID_ARGUMENT,
"flatbuffer verification failed: %s",
flatcc_verify_error_string(verify_ret));
}

iree_hal_rocm_ExecutableDef_table_t executable_def =
iree_hal_rocm_ExecutableDef_as_root(flatbuffer_data.data);
iree_hal_hip_ExecutableDef_table_t executable_def =
iree_hal_hip_ExecutableDef_as_root(flatbuffer_data.data);

flatbuffers_string_vec_t entry_points_vec =
iree_hal_rocm_ExecutableDef_entry_points_get(executable_def);
iree_hal_hip_ExecutableDef_entry_points_get(executable_def);
size_t entry_point_count = flatbuffers_string_vec_len(entry_points_vec);
if (entry_point_count == 0) {
return iree_make_status(IREE_STATUS_INVALID_ARGUMENT,
Expand All @@ -90,9 +90,9 @@ static iree_status_t iree_hal_hip_native_executable_flatbuffer_verify(
}
}

iree_hal_rocm_BlockSize_vec_t block_sizes_vec =
iree_hal_rocm_ExecutableDef_block_sizes_get(executable_def);
size_t block_size_count = iree_hal_rocm_BlockSize_vec_len(block_sizes_vec);
iree_hal_hip_BlockSize_vec_t block_sizes_vec =
iree_hal_hip_ExecutableDef_block_sizes_get(executable_def);
size_t block_size_count = iree_hal_hip_BlockSize_vec_len(block_sizes_vec);
if (entry_point_count != block_size_count) {
return iree_make_status(
IREE_STATUS_INVALID_ARGUMENT,
Expand All @@ -101,7 +101,7 @@ static iree_status_t iree_hal_hip_native_executable_flatbuffer_verify(
}

flatbuffers_uint32_vec_t shared_memory_sizes_vec =
iree_hal_rocm_ExecutableDef_shared_memory_sizes_get(executable_def);
iree_hal_hip_ExecutableDef_shared_memory_sizes_get(executable_def);
size_t shared_memory_sizes_count =
flatbuffers_string_vec_len(shared_memory_sizes_vec);
if (entry_point_count != shared_memory_sizes_count) {
Expand All @@ -112,7 +112,7 @@ static iree_status_t iree_hal_hip_native_executable_flatbuffer_verify(
}

flatbuffers_string_t hsaco_image =
iree_hal_rocm_ExecutableDef_hsaco_image_get(executable_def);
iree_hal_hip_ExecutableDef_hsaco_image_get(executable_def);
if (flatbuffers_string_len(hsaco_image) == 0) {
return iree_make_status(IREE_STATUS_INVALID_ARGUMENT,
"no HSACO image present");
Expand All @@ -137,18 +137,18 @@ iree_status_t iree_hal_hip_native_executable_create(
z0, iree_hal_hip_native_executable_flatbuffer_verify(
executable_params->executable_data));

iree_hal_rocm_ExecutableDef_table_t executable_def =
iree_hal_rocm_ExecutableDef_as_root(
iree_hal_hip_ExecutableDef_table_t executable_def =
iree_hal_hip_ExecutableDef_as_root(
executable_params->executable_data.data);

flatbuffers_string_vec_t entry_points_vec =
iree_hal_rocm_ExecutableDef_entry_points_get(executable_def);
iree_hal_rocm_BlockSize_vec_t block_sizes_vec =
iree_hal_rocm_ExecutableDef_block_sizes_get(executable_def);
iree_hal_hip_ExecutableDef_entry_points_get(executable_def);
iree_hal_hip_BlockSize_vec_t block_sizes_vec =
iree_hal_hip_ExecutableDef_block_sizes_get(executable_def);
flatbuffers_uint32_vec_t shared_memory_sizes_vec =
iree_hal_rocm_ExecutableDef_shared_memory_sizes_get(executable_def);
iree_hal_hip_ExecutableDef_shared_memory_sizes_get(executable_def);
flatbuffers_string_t hsaco_image =
iree_hal_rocm_ExecutableDef_hsaco_image_get(executable_def);
iree_hal_hip_ExecutableDef_hsaco_image_get(executable_def);
iree_host_size_t entry_point_count =
flatbuffers_string_vec_len(entry_points_vec);

Expand Down Expand Up @@ -213,7 +213,7 @@ iree_status_t iree_hal_hip_native_executable_create(

// Publish any embedded source files to the tracing infrastructure.
iree_hal_debug_publish_source_files(
iree_hal_rocm_ExecutableDef_source_files_get(executable_def));
iree_hal_hip_ExecutableDef_source_files_get(executable_def));

for (iree_host_size_t i = 0; i < entry_point_count; i++) {
// Lookup the function in the module; this should always succeed but we
Expand Down Expand Up @@ -287,10 +287,10 @@ iree_status_t iree_hal_hip_native_executable_create(
});

IREE_TRACE({
if (iree_hal_rocm_ExecutableDef_source_locations_is_present(
if (iree_hal_hip_ExecutableDef_source_locations_is_present(
executable_def)) {
iree_hal_debug_FileLineLocDef_vec_t source_locs_vec =
iree_hal_rocm_ExecutableDef_source_locations_get(executable_def);
iree_hal_hip_ExecutableDef_source_locations_get(executable_def);
iree_hal_debug_FileLineLocDef_table_t source_loc =
iree_hal_debug_FileLineLocDef_vec_at(source_locs_vec, i);
flatbuffers_string_t filename =
Expand Down
10 changes: 5 additions & 5 deletions runtime/src/iree/schemas/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ iree_flatbuffer_c_library(
)

iree_flatbuffer_c_library(
name = "metal_executable_def_c_fbs",
srcs = ["metal_executable_def.fbs"],
name = "hip_executable_def_c_fbs",
srcs = ["hip_executable_def.fbs"],
flatcc_args = FLATCC_ARGS,
includes = ["executable_debug_info.fbs"],
)

iree_flatbuffer_c_library(
name = "rocm_executable_def_c_fbs",
srcs = ["rocm_executable_def.fbs"],
name = "metal_executable_def_c_fbs",
srcs = ["metal_executable_def.fbs"],
flatcc_args = FLATCC_ARGS,
includes = ["executable_debug_info.fbs"],
)
Expand All @@ -73,8 +73,8 @@ iree_build_test(
":bytecode_module_def_c_fbs",
":cuda_executable_def_c_fbs",
":executable_debug_info_c_fbs",
":hip_executable_def_c_fbs",
":metal_executable_def_c_fbs",
":rocm_executable_def_c_fbs",
":spirv_executable_def_c_fbs",
":wgsl_executable_def_c_fbs",
],
Expand Down
8 changes: 4 additions & 4 deletions runtime/src/iree/schemas/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ flatbuffer_c_library(

flatbuffer_c_library(
NAME
metal_executable_def_c_fbs
hip_executable_def_c_fbs
SRCS
"metal_executable_def.fbs"
"hip_executable_def.fbs"
FLATCC_ARGS
"--reader"
"--builder"
Expand All @@ -68,9 +68,9 @@ flatbuffer_c_library(

flatbuffer_c_library(
NAME
rocm_executable_def_c_fbs
metal_executable_def_c_fbs
SRCS
"rocm_executable_def.fbs"
"metal_executable_def.fbs"
FLATCC_ARGS
"--reader"
"--builder"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

include "iree/schemas/executable_debug_info.fbs";

namespace iree.hal.rocm;
namespace iree.hal.hip;

// 'ROCM Executable'.
file_identifier "ROCM";
file_extension "rocm";
// 'HIP Executable'.
file_identifier "HIPE";
file_extension "hipe";

// A struct for the kernel block size along each dimensions.
struct BlockSize {
Expand Down

0 comments on commit edc6428

Please sign in to comment.