From 24bf0acf3ab4c9a8c345b1e56589d1aed5c90c5e Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 28 Feb 2024 19:54:41 -0800 Subject: [PATCH] [hip] Optionally enable graph command buffer and tests (#16604) This commit made `hipDrvGraphAddMemcpyNode` as an optional symbol so that even when we are missing it we can still build the hip HAL driver without problem. Instead it will error out at runtime. This allows us to start testing the hip graph based command buffer. For that, tests are registered. --- experimental/hip/cts/CMakeLists.txt | 26 +++ experimental/hip/dynamic_symbol_tables.h | 174 ++++++++++-------- experimental/hip/dynamic_symbols.c | 20 +- experimental/hip/dynamic_symbols.h | 11 +- experimental/hip/graph_command_buffer.c | 18 +- .../hip/tests/stablehlo_ops/CMakeLists.txt | 83 +++++++++ .../hip/tests/tosa_ops/CMakeLists.txt | 63 +++++++ 7 files changed, 301 insertions(+), 94 deletions(-) diff --git a/experimental/hip/cts/CMakeLists.txt b/experimental/hip/cts/CMakeLists.txt index e5954954da64..24d12a33a7fc 100644 --- a/experimental/hip/cts/CMakeLists.txt +++ b/experimental/hip/cts/CMakeLists.txt @@ -39,3 +39,29 @@ iree_hal_cts_test_suite( LABELS driver=hip ) + +iree_hal_cts_test_suite( + DRIVER_NAME + hip + VARIANT_SUFFIX + graph + DRIVER_REGISTRATION_HDR + "experimental/hip/registration/driver_module.h" + DRIVER_REGISTRATION_FN + "iree_hal_hip_driver_module_register" + COMPILER_TARGET_BACKEND + "rocm" + EXECUTABLE_FORMAT + "\"HSACO\"" + COMPILER_FLAGS + ${IREE_HIP_TEST_COMPILER_FLAGS} + ARGS + "--hip_use_streams=false" + DEPS + iree::experimental::hip::registration + EXCLUDED_TESTS + # HAL event is unimplemented for now. + "event" + LABELS + driver=hip +) diff --git a/experimental/hip/dynamic_symbol_tables.h b/experimental/hip/dynamic_symbol_tables.h index 5f5aef278759..bbcb1d490ab3 100644 --- a/experimental/hip/dynamic_symbol_tables.h +++ b/experimental/hip/dynamic_symbol_tables.h @@ -8,80 +8,104 @@ // HIP symbols //===----------------------------------------------------------------------===// -IREE_HIP_PFN_DECL(hipCtxSetCurrent, hipCtx_t) -IREE_HIP_PFN_DECL(hipDeviceGet, hipDevice_t *, int) -IREE_HIP_PFN_DECL(hipDeviceGetAttribute, int *, hipDeviceAttribute_t, int) -IREE_HIP_PFN_DECL(hipDeviceGetName, char *, int, hipDevice_t) -IREE_HIP_PFN_DECL(hipDeviceGetUuid, hipUUID *, hipDevice_t) -IREE_HIP_PFN_DECL(hipDevicePrimaryCtxRelease, hipDevice_t) -IREE_HIP_PFN_DECL(hipDevicePrimaryCtxRetain, hipCtx_t *, hipDevice_t) -IREE_HIP_PFN_DECL(hipEventCreate, hipEvent_t *) -IREE_HIP_PFN_DECL(hipEventCreateWithFlags, hipEvent_t *, unsigned int) -IREE_HIP_PFN_DECL(hipEventDestroy, hipEvent_t) -IREE_HIP_PFN_DECL(hipEventElapsedTime, float *, hipEvent_t, hipEvent_t) -IREE_HIP_PFN_DECL(hipEventQuery, hipEvent_t) -IREE_HIP_PFN_DECL(hipEventRecord, hipEvent_t, hipStream_t) -IREE_HIP_PFN_DECL(hipEventSynchronize, hipEvent_t) -IREE_HIP_PFN_DECL(hipFree, void *) -IREE_HIP_PFN_DECL(hipFreeAsync, void *, hipStream_t) -IREE_HIP_PFN_DECL(hipFuncSetAttribute, const void *, hipFuncAttribute, int) -IREE_HIP_PFN_DECL(hipGetDeviceCount, int *) -IREE_HIP_PFN_DECL(hipGetDeviceProperties, hipDeviceProp_t *, int) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipCtxSetCurrent, hipCtx_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipDeviceGet, hipDevice_t *, int) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipDeviceGetAttribute, int *, + hipDeviceAttribute_t, int) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipDeviceGetName, char *, int, hipDevice_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipDeviceGetUuid, hipUUID *, hipDevice_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipDevicePrimaryCtxRelease, hipDevice_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipDevicePrimaryCtxRetain, hipCtx_t *, + hipDevice_t) +IREE_HAL_HIP_OPTIONAL_PFN_DECL(hipDrvGraphAddMemcpyNode, hipGraphNode_t *, + hipGraph_t, const hipGraphNode_t *, size_t, + const HIP_MEMCPY3D *, hipCtx_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipEventCreate, hipEvent_t *) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipEventCreateWithFlags, hipEvent_t *, + unsigned int) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipEventDestroy, hipEvent_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipEventElapsedTime, float *, hipEvent_t, + hipEvent_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipEventQuery, hipEvent_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipEventRecord, hipEvent_t, hipStream_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipEventSynchronize, hipEvent_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipFree, void *) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipFreeAsync, void *, hipStream_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipFuncSetAttribute, const void *, + hipFuncAttribute, int) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipGetDeviceCount, int *) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipGetDeviceProperties, hipDeviceProp_t *, int) // hipGetErrorName(hipError_t) and hipGetErrorString(hipError_t) return // const char* instead of hipError_t so it uses a different macro. -IREE_HIP_PFN_STR_DECL(hipGetErrorName, hipError_t) -IREE_HIP_PFN_STR_DECL(hipGetErrorString, hipError_t) -IREE_HIP_PFN_DECL(hipGraphAddEmptyNode, hipGraphNode_t *, hipGraph_t, - const hipGraphNode_t *, size_t) -IREE_HIP_PFN_DECL(hipGraphAddKernelNode, hipGraphNode_t *, hipGraph_t, - const hipGraphNode_t *, size_t, const hipKernelNodeParams *) -IREE_HIP_PFN_DECL(hipGraphAddMemsetNode, hipGraphNode_t *, hipGraph_t, - const hipGraphNode_t *, size_t, const hipMemsetParams *) -IREE_HIP_PFN_DECL(hipGraphCreate, hipGraph_t *, unsigned int) -IREE_HIP_PFN_DECL(hipGraphDestroy, hipGraph_t) -IREE_HIP_PFN_DECL(hipGraphExecDestroy, hipGraphExec_t) -IREE_HIP_PFN_DECL(hipGraphInstantiate, hipGraphExec_t *, hipGraph_t, - hipGraphNode_t *, char *, size_t) -IREE_HIP_PFN_DECL(hipGraphLaunch, hipGraphExec_t, hipStream_t) -IREE_HIP_PFN_DECL(hipHostFree, void *) -IREE_HIP_PFN_DECL(hipHostGetDevicePointer, void **, void *, unsigned int) -IREE_HIP_PFN_DECL(hipHostMalloc, void **, size_t, unsigned int) -IREE_HIP_PFN_DECL(hipHostRegister, void *, size_t, unsigned int) -IREE_HIP_PFN_DECL(hipHostUnregister, void *) -IREE_HIP_PFN_DECL(hipInit, unsigned int) -IREE_HIP_PFN_DECL(hipLaunchHostFunc, hipStream_t, hipHostFn_t, void *) -IREE_HIP_PFN_DECL(hipLaunchKernel, const void *, dim3, dim3, void **, size_t, - hipStream_t) -IREE_HIP_PFN_DECL(hipMalloc, void **, size_t) -IREE_HIP_PFN_DECL(hipMallocFromPoolAsync, void **, size_t, hipMemPool_t, - hipStream_t) -IREE_HIP_PFN_DECL(hipMallocManaged, hipDeviceptr_t *, size_t, unsigned int) -IREE_HIP_PFN_DECL(hipMemcpy, void *, const void *, size_t, hipMemcpyKind) -IREE_HIP_PFN_DECL(hipMemcpyAsync, void *, const void *, size_t, hipMemcpyKind, - hipStream_t) -IREE_HIP_PFN_DECL(hipMemcpyHtoDAsync, hipDeviceptr_t, void *, size_t, - hipStream_t) -IREE_HIP_PFN_DECL(hipMemPoolCreate, hipMemPool_t *, const hipMemPoolProps *) -IREE_HIP_PFN_DECL(hipMemPoolDestroy, hipMemPool_t) -IREE_HIP_PFN_DECL(hipMemPoolGetAttribute, hipMemPool_t, hipMemPoolAttr, void *) -IREE_HIP_PFN_DECL(hipMemPoolSetAttribute, hipMemPool_t, hipMemPoolAttr, void *) -IREE_HIP_PFN_DECL(hipMemPoolTrimTo, hipMemPool_t, size_t) -IREE_HIP_PFN_DECL(hipMemPrefetchAsync, const void *, size_t, int, hipStream_t) -IREE_HIP_PFN_DECL(hipMemset, void *, int, size_t) -IREE_HIP_PFN_DECL(hipMemsetAsync, void *, int, size_t, hipStream_t) -IREE_HIP_PFN_DECL(hipMemsetD8Async, void *, char, size_t, hipStream_t) -IREE_HIP_PFN_DECL(hipMemsetD16Async, void *, short, size_t, hipStream_t) -IREE_HIP_PFN_DECL(hipMemsetD32Async, void *, int, size_t, hipStream_t) -IREE_HIP_PFN_DECL(hipModuleGetFunction, hipFunction_t *, hipModule_t, - const char *) -IREE_HIP_PFN_DECL(hipModuleLaunchKernel, hipFunction_t, unsigned int, - unsigned int, unsigned int, unsigned int, unsigned int, - unsigned int, unsigned int, hipStream_t, void **, void **) -IREE_HIP_PFN_DECL(hipModuleLoadData, hipModule_t *, const void *) -IREE_HIP_PFN_DECL(hipModuleLoadDataEx, hipModule_t *, const void *, - unsigned int, hipJitOption *, void **) -IREE_HIP_PFN_DECL(hipModuleUnload, hipModule_t) -IREE_HIP_PFN_DECL(hipStreamCreateWithFlags, hipStream_t *, unsigned int) -IREE_HIP_PFN_DECL(hipStreamDestroy, hipStream_t) -IREE_HIP_PFN_DECL(hipStreamSynchronize, hipStream_t) -IREE_HIP_PFN_DECL(hipStreamWaitEvent, hipStream_t, hipEvent_t, unsigned int) +IREE_HAL_HIP_REQUIRED_PFN_STR_DECL(hipGetErrorName, hipError_t) +IREE_HAL_HIP_REQUIRED_PFN_STR_DECL(hipGetErrorString, hipError_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipGraphAddEmptyNode, hipGraphNode_t *, + hipGraph_t, const hipGraphNode_t *, size_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipGraphAddKernelNode, hipGraphNode_t *, + hipGraph_t, const hipGraphNode_t *, size_t, + const hipKernelNodeParams *) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipGraphAddMemsetNode, hipGraphNode_t *, + hipGraph_t, const hipGraphNode_t *, size_t, + const hipMemsetParams *) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipGraphCreate, hipGraph_t *, unsigned int) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipGraphDestroy, hipGraph_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipGraphExecDestroy, hipGraphExec_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipGraphInstantiate, hipGraphExec_t *, + hipGraph_t, hipGraphNode_t *, char *, size_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipGraphLaunch, hipGraphExec_t, hipStream_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipHostFree, void *) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipHostGetDevicePointer, void **, void *, + unsigned int) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipHostMalloc, void **, size_t, unsigned int) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipHostRegister, void *, size_t, unsigned int) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipHostUnregister, void *) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipInit, unsigned int) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipLaunchHostFunc, hipStream_t, hipHostFn_t, + void *) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipLaunchKernel, const void *, dim3, dim3, + void **, size_t, hipStream_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipMalloc, void **, size_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipMallocFromPoolAsync, void **, size_t, + hipMemPool_t, hipStream_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipMallocManaged, hipDeviceptr_t *, size_t, + unsigned int) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipMemcpy, void *, const void *, size_t, + hipMemcpyKind) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipMemcpyAsync, void *, const void *, size_t, + hipMemcpyKind, hipStream_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipMemcpyHtoDAsync, hipDeviceptr_t, void *, + size_t, hipStream_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipMemPoolCreate, hipMemPool_t *, + const hipMemPoolProps *) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipMemPoolDestroy, hipMemPool_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipMemPoolGetAttribute, hipMemPool_t, + hipMemPoolAttr, void *) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipMemPoolSetAttribute, hipMemPool_t, + hipMemPoolAttr, void *) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipMemPoolTrimTo, hipMemPool_t, size_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipMemPrefetchAsync, const void *, size_t, int, + hipStream_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipMemset, void *, int, size_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipMemsetAsync, void *, int, size_t, hipStream_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipMemsetD8Async, void *, char, size_t, + hipStream_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipMemsetD16Async, void *, short, size_t, + hipStream_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipMemsetD32Async, void *, int, size_t, + hipStream_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipModuleGetFunction, hipFunction_t *, + hipModule_t, const char *) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipModuleLaunchKernel, hipFunction_t, + unsigned int, unsigned int, unsigned int, + unsigned int, unsigned int, unsigned int, + unsigned int, hipStream_t, void **, void **) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipModuleLoadData, hipModule_t *, const void *) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipModuleLoadDataEx, hipModule_t *, const void *, + unsigned int, hipJitOption *, void **) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipModuleUnload, hipModule_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipStreamCreateWithFlags, hipStream_t *, + unsigned int) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipStreamDestroy, hipStream_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipStreamSynchronize, hipStream_t) +IREE_HAL_HIP_REQUIRED_PFN_DECL(hipStreamWaitEvent, hipStream_t, hipEvent_t, + unsigned int) diff --git a/experimental/hip/dynamic_symbols.c b/experimental/hip/dynamic_symbols.c index 75cb6fcd16b0..539ebb4f6e4f 100644 --- a/experimental/hip/dynamic_symbols.c +++ b/experimental/hip/dynamic_symbols.c @@ -9,10 +9,9 @@ #include #include "experimental/hip/status_util.h" -#include "iree/base/assert.h" +#include "iree/base/api.h" #include "iree/base/internal/dynamic_library.h" #include "iree/base/target_platform.h" -#include "iree/base/tracing.h" //===----------------------------------------------------------------------===// // HIP dynamic symbols @@ -29,17 +28,24 @@ static const char* iree_hal_hip_dylib_names[] = { // Resolves all HIP dynamic symbols in `dynamic_symbol_tables.h` static iree_status_t iree_hal_hip_dynamic_symbols_resolve_all( iree_hal_hip_dynamic_symbols_t* syms) { -#define IREE_HIP_PFN_DECL(hip_symbol_name, ...) \ +#define IREE_HAL_HIP_REQUIRED_PFN_DECL(hip_symbol_name, ...) \ { \ static const char* name = #hip_symbol_name; \ IREE_RETURN_IF_ERROR(iree_dynamic_library_lookup_symbol( \ syms->dylib, name, (void**)&syms->hip_symbol_name)); \ } -#define IREE_HIP_PFN_STR_DECL(hip_symbol_name, ...) \ - IREE_HIP_PFN_DECL(hip_symbol_name, ...) +#define IREE_HAL_HIP_REQUIRED_PFN_STR_DECL(hip_symbol_name, ...) \ + IREE_HAL_HIP_REQUIRED_PFN_DECL(hip_symbol_name, ...) +#define IREE_HAL_HIP_OPTIONAL_PFN_DECL(hip_symbol_name, ...) \ + { \ + static const char* name = #hip_symbol_name; \ + IREE_IGNORE_ERROR(iree_dynamic_library_lookup_symbol( \ + syms->dylib, name, (void**)&syms->hip_symbol_name)); \ + } #include "experimental/hip/dynamic_symbol_tables.h" // IWYU pragma: keep -#undef IREE_HIP_PFN_DECL -#undef IREE_HIP_PFN_STR_DECL +#undef IREE_HAL_HIP_REQUIRED_PFN_DECL +#undef IREE_HAL_HIP_REQUIRED_PFN_STR_DECL +#undef IREE_HAL_HIP_OPTIONAL_PFN_DECL return iree_ok_status(); } diff --git a/experimental/hip/dynamic_symbols.h b/experimental/hip/dynamic_symbols.h index 7b04ec22cfe1..4a7ac019046e 100644 --- a/experimental/hip/dynamic_symbols.h +++ b/experimental/hip/dynamic_symbols.h @@ -30,13 +30,16 @@ typedef struct iree_hal_hip_dynamic_symbols_t { iree_dynamic_library_t* dylib; // Concrete HIP symbols defined by including the `dynamic_symbol_tables.h`. -#define IREE_HIP_PFN_DECL(hipSymbolName, ...) \ +#define IREE_HAL_HIP_REQUIRED_PFN_DECL(hipSymbolName, ...) \ hipError_t (*hipSymbolName)(__VA_ARGS__); -#define IREE_HIP_PFN_STR_DECL(hipSymbolName, ...) \ +#define IREE_HAL_HIP_REQUIRED_PFN_STR_DECL(hipSymbolName, ...) \ const char* (*hipSymbolName)(__VA_ARGS__); +#define IREE_HAL_HIP_OPTIONAL_PFN_DECL(hipSymbolName, ...) \ + hipError_t (*hipSymbolName)(__VA_ARGS__); #include "experimental/hip/dynamic_symbol_tables.h" // IWYU pragma: export -#undef IREE_HIP_PFN_DECL -#undef IREE_HIP_PFN_STR_DECL +#undef IREE_HAL_HIP_REQUIRED_PFN_DECL +#undef IREE_HAL_HIP_REQUIRED_PFN_STR_DECL +#undef IREE_HAL_HIP_OPTIONAL_PFN_DECL } iree_hal_hip_dynamic_symbols_t; // Initializes |out_syms| in-place with dynamically loaded HIP symbols. diff --git a/experimental/hip/graph_command_buffer.c b/experimental/hip/graph_command_buffer.c index 3d94b5239cef..222796c92087 100644 --- a/experimental/hip/graph_command_buffer.c +++ b/experimental/hip/graph_command_buffer.c @@ -359,11 +359,13 @@ static iree_status_t iree_hal_hip_graph_command_buffer_update_buffer( iree_hal_command_buffer_t* base_command_buffer, const void* source_buffer, iree_host_size_t source_offset, iree_hal_buffer_t* target_buffer, iree_device_size_t target_offset, iree_device_size_t length) { - return iree_make_status(IREE_STATUS_UNIMPLEMENTED, - "update buffer not yet implemented"); - /* iree_hal_hip_graph_command_buffer_t* command_buffer = iree_hal_hip_graph_command_buffer_cast(base_command_buffer); + if (command_buffer->symbols->hipDrvGraphAddMemcpyNode == NULL) { + return iree_make_status(IREE_STATUS_UNAVAILABLE, + "missing hipDrvGraphAddMemcpyNode symbol; " + "cannot use graph-based command buffer"); + } IREE_TRACE_ZONE_BEGIN(z0); // Allocate scratch space in the arena for the data and copy it in. @@ -413,7 +415,6 @@ static iree_status_t iree_hal_hip_graph_command_buffer_update_buffer( IREE_TRACE_ZONE_END(z0); return iree_ok_status(); - */ } static iree_status_t iree_hal_hip_graph_command_buffer_copy_buffer( @@ -421,11 +422,13 @@ static iree_status_t iree_hal_hip_graph_command_buffer_copy_buffer( iree_hal_buffer_t* source_buffer, iree_device_size_t source_offset, iree_hal_buffer_t* target_buffer, iree_device_size_t target_offset, iree_device_size_t length) { - return iree_make_status(IREE_STATUS_UNIMPLEMENTED, - "copy buffer not yet implemented"); - /* iree_hal_hip_graph_command_buffer_t* command_buffer = iree_hal_hip_graph_command_buffer_cast(base_command_buffer); + if (command_buffer->symbols->hipDrvGraphAddMemcpyNode == NULL) { + return iree_make_status(IREE_STATUS_UNAVAILABLE, + "missing hipDrvGraphAddMemcpyNode symbol; " + "cannot use graph-based command buffer"); + } IREE_TRACE_ZONE_BEGIN(z0); const iree_hal_buffer_t* buffers[2] = {source_buffer, target_buffer}; @@ -469,7 +472,6 @@ static iree_status_t iree_hal_hip_graph_command_buffer_copy_buffer( IREE_TRACE_ZONE_END(z0); return iree_ok_status(); - */ } static iree_status_t iree_hal_hip_graph_command_buffer_collective( diff --git a/experimental/hip/tests/stablehlo_ops/CMakeLists.txt b/experimental/hip/tests/stablehlo_ops/CMakeLists.txt index d6a0b8393623..4433e071fa4d 100644 --- a/experimental/hip/tests/stablehlo_ops/CMakeLists.txt +++ b/experimental/hip/tests/stablehlo_ops/CMakeLists.txt @@ -96,3 +96,86 @@ iree_check_single_backend_test_suite( "noubsan" "requires-gpu-amd" ) + +iree_check_single_backend_test_suite( + NAME + check_hip_graph + SRCS + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/abs.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/add.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/batch_norm_inference.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/bitcast_convert.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/broadcast.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/broadcast_add.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/broadcast_in_dim.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/clamp.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/compare.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/complex.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/concatenate.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/constant.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/convert.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/convolution.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/cosine.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/divide.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/dot.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/dot_bf16.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/dot_general.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/dynamic_slice.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/dynamic_update_slice.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/exponential.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/exponential_fp16.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/exponential_minus_one.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/fft.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/finite.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/floor.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/gather.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/householder.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/iota.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/log.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/log_plus_one.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/maximum.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/minimum.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/multiply.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/negate.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/pad.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/philox.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/pow.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/reduce.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/reduce_window.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/remainder.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/reshape.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/reverse.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/rng_normal.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/rng_uniform.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/round.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/rsqrt.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/scatter.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/scatter_dynamic.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/select.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/sine.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/slice.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/sort.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/sqrt.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/subtract.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/tanh.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/three_fry.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/torch_index_select.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/transpose.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/stablehlo_ops/while.mlir" + TARGET_BACKEND + "rocm" + DRIVER + "hip" + COMPILER_FLAGS + ${IREE_HIP_TEST_COMPILER_FLAGS} + INPUT_TYPE + "stablehlo" + RUNNER_ARGS + "--hip_use_streams=false" + LABELS + "noasan" + "nomsan" + "notsan" + "noubsan" + "requires-gpu-amd" +) diff --git a/experimental/hip/tests/tosa_ops/CMakeLists.txt b/experimental/hip/tests/tosa_ops/CMakeLists.txt index 7b2104e52107..8c2b00ab64d8 100644 --- a/experimental/hip/tests/tosa_ops/CMakeLists.txt +++ b/experimental/hip/tests/tosa_ops/CMakeLists.txt @@ -76,3 +76,66 @@ iree_check_single_backend_test_suite( "noubsan" "requires-gpu-amd" ) + +iree_check_single_backend_test_suite( + NAME + check_hip_graph + SRCS + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/abs.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/add.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/arithmetic_right_shift.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/bitwise_and.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/bitwise_or.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/bitwise_xor.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/ceil.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/clamp.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/clz.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/const.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/equal.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/exp.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/floor.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/fully_connected.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/gather.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/greater.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/greater_equal.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/if.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/log.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/logical_left_shift.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/logical_right_shift.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/logical_right_shift_16.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/matmul.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/max_pool.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/maximum.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/minimum.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/mul.mlir" + #"${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/mul_shift.mlir" (compilation failure) + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/negate.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/pad.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/reciprocal.mlir" + #"${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/reduce.mlir" (compilation failure) + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/reshape.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/rsqrt.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/select.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/sigmoid.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/sub.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/table.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/tanh.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/transpose.mlir" + "${IREE_SOURCE_DIR}/tests/e2e/tosa_ops/while.mlir" + TARGET_BACKEND + "rocm" + DRIVER + "hip" + COMPILER_FLAGS + ${IREE_HIP_TEST_COMPILER_FLAGS} + INPUT_TYPE + "tosa" + RUNNER_ARGS + "--hip_use_streams=false" + LABELS + "noasan" + "nomsan" + "notsan" + "noubsan" + "requires-gpu-amd" +)