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
85 lines
2.5 KiB
C++
85 lines
2.5 KiB
C++
/*
|
|
* Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
#include <hip_test_common.hh>
|
|
#include <resource_guards.hh>
|
|
|
|
#include "atomic_builtins_kernels_rtc.hh"
|
|
|
|
/**
|
|
* @addtogroup __hip_atomic_fetch_add __hip_atomic_fetch_add
|
|
* @{
|
|
* @ingroup AtomicsTest
|
|
*/
|
|
|
|
void AtomicBuiltinsRTCWrapper(const char* program_source, int expected_errors_num,
|
|
int expected_warnings_num) {
|
|
hiprtcProgram program{};
|
|
HIPRTC_CHECK(hiprtcCreateProgram(&program, program_source, "atomics_builtins_kernels.cc", 0,
|
|
nullptr, nullptr));
|
|
|
|
hiprtcResult result{hiprtcCompileProgram(program, 0, nullptr)};
|
|
|
|
size_t log_size{};
|
|
HIPRTC_CHECK(hiprtcGetProgramLogSize(program, &log_size));
|
|
std::string log(log_size, ' ');
|
|
HIPRTC_CHECK(hiprtcGetProgramLog(program, log.data()));
|
|
int error_count{0};
|
|
int warning_count{0};
|
|
|
|
std::string error_message{"error:"};
|
|
std::string warning_message{"warning:"};
|
|
|
|
size_t npos_e = log.find(error_message, 0);
|
|
while (npos_e != std::string::npos) {
|
|
++error_count;
|
|
npos_e = log.find(error_message, npos_e + 1);
|
|
}
|
|
|
|
size_t npos_w = log.find(warning_message, 0);
|
|
while (npos_w != std::string::npos) {
|
|
++warning_count;
|
|
npos_w = log.find(warning_message, npos_w + 1);
|
|
}
|
|
|
|
HIPRTC_CHECK(hiprtcDestroyProgram(&program));
|
|
HIPRTC_CHECK_ERROR(result, HIPRTC_ERROR_COMPILATION);
|
|
REQUIRE(error_count == expected_errors_num);
|
|
REQUIRE(warning_count == expected_warnings_num);
|
|
}
|
|
|
|
/**
|
|
* Test Description
|
|
* ------------------------
|
|
* - Compiles atomic builtins while passing parameters that shall cause:
|
|
* -# Compiler warnings
|
|
* -# Compiler errors
|
|
* Test source
|
|
* ------------------------
|
|
* - unit/atomics/atomic_builtins.cc
|
|
* Test requirements
|
|
* ------------------------
|
|
* - HIP_VERSION >= 5.2
|
|
*/
|
|
HIP_TEST_CASE(Unit_AtomicBuiltins_Negative_Parameters_RTC) {
|
|
AtomicBuiltinsRTCWrapper(kBuiltinStore, 5, 5);
|
|
AtomicBuiltinsRTCWrapper(kBuiltinLoad, 4, 4);
|
|
AtomicBuiltinsRTCWrapper(kBuiltinCompExWeak, 5, 7);
|
|
AtomicBuiltinsRTCWrapper(kBuiltinCompExStrong, 5, 7);
|
|
AtomicBuiltinsRTCWrapper(kBuiltinExchange, 5, 2);
|
|
AtomicBuiltinsRTCWrapper(kBuiltinFetchAdd, 5, 2);
|
|
AtomicBuiltinsRTCWrapper(kBuiltinFetchAnd, 7, 2);
|
|
AtomicBuiltinsRTCWrapper(kBuiltinFetchOr, 7, 2);
|
|
AtomicBuiltinsRTCWrapper(kBuiltinFetchXor, 7, 2);
|
|
AtomicBuiltinsRTCWrapper(kBuiltinFetchMax, 5, 2);
|
|
AtomicBuiltinsRTCWrapper(kBuiltinFetchMin, 5, 2);
|
|
}
|
|
|
|
/**
|
|
* End doxygen group AtomicsTest.
|
|
* @}
|
|
*/
|