diff --git a/catch/unit/device/CMakeLists.txt b/catch/unit/device/CMakeLists.txt index a8d304de7a..82b44ced5f 100644 --- a/catch/unit/device/CMakeLists.txt +++ b/catch/unit/device/CMakeLists.txt @@ -16,6 +16,7 @@ set(TEST_SRC hipGetSetDeviceFlags.cc hipSetGetDevice.cc hipDeviceGetUuid.cc + hipDeviceAPUCheck.cc hipDeviceGetDefaultMemPool.cc hipDeviceCanAccessPeer.cc hipDeviceEnableDisablePeerAccess.cc diff --git a/catch/unit/device/hipDeviceAPUCheck.cc b/catch/unit/device/hipDeviceAPUCheck.cc new file mode 100644 index 0000000000..748748c2c9 --- /dev/null +++ b/catch/unit/device/hipDeviceAPUCheck.cc @@ -0,0 +1,53 @@ +/* +Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +#include + +/** + * @addtogroup hipDeviceAPUCheck + * @{ + * @ingroup DeviceTest + * `hipGetDeviceProperties(const hipDeviceProp_t* prop, int device)` - + * Device which matches `hipDeviceProp_t` is returned. + */ + +/** + * Test Description + * ------------------------ + * - Prints if the system is an APU or has discrete graphics card. + * Test source + * ------------------------ + * - unit/device/hipDeviceAPUCheck.cc + * Test requirements + * ------------------------ + * - HIP_VERSION >= 6.2 + */ +TEST_CASE("Unit_hipDeviceAPUCheck") { + hipDeviceProp_t prop; + HIP_CHECK(hipGetDeviceProperties(&prop, 0)); + if (!prop.integrated) { + HipTest::HIP_SKIP_TEST("This device is a Discrete Graphics card. So skipping test"); + return; + } else { + std::cout<<"This device is an APU"<