Files
TheRock/rocm-systems/projects/hip-tests/catch/unit/graph/hipGraphAddBatchMemOpNode.cc
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

109 lines
3.6 KiB
C++

/*
* Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
*
* SPDX-License-Identifier: MIT
*/
#include <hip_test_common.hh>
#include <hip_test_defgroups.hh>
/**
* @addtogroup hipGraphAddBatchMemOpNode hipGraphAddBatchMemOpNode
* @{
* @ingroup GraphTest
* `hipError_t hipGraphAddBatchMemOpNode(hipGraphNode_t *phGraphNode, hipGraph_t
hGraph, const hipGraphNode_t *dependencies, size_t numDependencies, const
hipBatchMemOpNodeParams* nodeParams);`
* - Creates a batch memory operation node and adds it to a graph
*/
/**
* Test Description
* ------------------------
* - Verify the Negative cases of the hipGraphAddBatchMemOpNode API.
* Test source
* ------------------------
* - unit/graph/hipGraphAddBatchMemOpNode.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 6.4
*/
HIP_TEST_CASE(Unit_hipGraphAddBatchMemOpNode_NegativeTsts) {
HIP_CHECK(hipInit(0));
hipGraph_t graph;
hipCtx_t ctx;
hipDevice_t device;
HIP_CHECK(hipDeviceGet(&device, 0));
HIP_CHECK(hipCtxCreate(&ctx, 0, device));
// Create a HIP graph
HIP_CHECK(hipGraphCreate(&graph, 0));
INFO("Graph created.");
static hipStreamBatchMemOpParams paramArray[2];
std::vector<hipDeviceptr_t> opsArray(1);
HIP_CHECK(hipMalloc((void**)&opsArray[0], sizeof(uint32_t)));
paramArray[0].operation = hipStreamMemOpWriteValue32;
paramArray[0].writeValue.address = opsArray[0];
paramArray[0].writeValue.value = 1000;
paramArray[0].writeValue.flags = 0x0;
paramArray[0].writeValue.alias = 0;
paramArray[1].operation = hipStreamMemOpWaitValue32;
paramArray[1].waitValue.address = opsArray[0];
paramArray[1].waitValue.value = 1000;
paramArray[1].waitValue.flags = hipStreamWaitValueEq;
int totalOps = 2;
// Setup the batch memory operation node parameters
hipBatchMemOpNodeParams batchNodeParams, inValidBatchNodeParams;
batchNodeParams.ctx = ctx; // Use the current HIP context
batchNodeParams.count = totalOps; // Total number of memory operations
batchNodeParams.paramArray = paramArray; // Pointer to the array of memory operations
batchNodeParams.flags = 0; // No special flags
inValidBatchNodeParams.ctx = ctx;
inValidBatchNodeParams.count = -2;
inValidBatchNodeParams.paramArray = nullptr;
inValidBatchNodeParams.flags = -2;
hipGraphNode_t batchMemOpNode;
SECTION("Graph as null pointer") {
HIP_CHECK_ERROR(
hipGraphAddBatchMemOpNode(&batchMemOpNode, nullptr, nullptr, 0, &batchNodeParams),
hipErrorInvalidValue);
}
SECTION("Number of Dependencies as Negative value") {
HIP_CHECK_ERROR(
hipGraphAddBatchMemOpNode(&batchMemOpNode, graph, nullptr, -2, &batchNodeParams),
hipErrorInvalidValue);
}
// Disabled for NVIDIA due to the defect SWDEV-502247
#if HT_AMD
SECTION("Node Params as nullptr") {
HIP_CHECK_ERROR(hipGraphAddBatchMemOpNode(&batchMemOpNode, graph, nullptr, 0, nullptr),
hipErrorInvalidValue);
}
#endif
SECTION("Graph Node as nullptr") {
HIP_CHECK_ERROR(hipGraphAddBatchMemOpNode(nullptr, graph, nullptr, 0, &batchNodeParams),
hipErrorInvalidValue);
}
// Disabled due to defect SWDEV-502219
#if 0
SECTION("Invalid node params") {
HIP_CHECK_ERROR(hipGraphAddBatchMemOpNode(&batchMemOpNode, graph, nullptr,
0, &inValidBatchNodeParams),
hipErrorInvalidValue);
}
#endif
HIP_CHECK(hipFree((void*)opsArray[0]));
HIP_CHECK(hipGraphDestroy(graph));
HIP_CHECK(hipCtxPopCurrent(&ctx));
HIP_CHECK(hipCtxDestroy(ctx));
}
/**
* End doxygen group GraphTest.
* @}
*/