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
117 lines
4.5 KiB
C++
117 lines
4.5 KiB
C++
// Copyright © Advanced Micro Devices, Inc., or its affiliates.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include <cstdint>
|
|
#include <unordered_map>
|
|
#include <vector>
|
|
|
|
#include <hipdnn_flatbuffers_sdk/flatbuffer_utilities/GraphWrapper.hpp>
|
|
|
|
#include "ConvolutionFwdGraphTestUtils.hpp"
|
|
#include "harness/gpu-graph-executor/detail/GpuConvolutionFwdSignatureKey.hpp"
|
|
|
|
using namespace hipdnn_flatbuffers_sdk::data_objects;
|
|
using namespace hipdnn_integration_tests::test_utils;
|
|
using namespace hipdnn_integration_tests::gpu_graph_executor::detail;
|
|
|
|
TEST(TestGpuConvolutionFwdSignatureKey, EqualityOperator)
|
|
{
|
|
const GpuConvolutionFwdSignatureKey key1{
|
|
DataType::FLOAT, DataType::FLOAT, DataType::FLOAT, DataType::FLOAT};
|
|
const GpuConvolutionFwdSignatureKey key2{
|
|
DataType::FLOAT, DataType::FLOAT, DataType::FLOAT, DataType::FLOAT};
|
|
EXPECT_TRUE(key1 == key2);
|
|
|
|
const GpuConvolutionFwdSignatureKey key3{
|
|
DataType::HALF, DataType::FLOAT, DataType::HALF, DataType::FLOAT};
|
|
const GpuConvolutionFwdSignatureKey key4{
|
|
DataType::HALF, DataType::FLOAT, DataType::HALF, DataType::FLOAT};
|
|
EXPECT_TRUE(key3 == key4);
|
|
|
|
const GpuConvolutionFwdSignatureKey key5{
|
|
DataType::FLOAT, DataType::FLOAT, DataType::FLOAT, DataType::FLOAT};
|
|
const GpuConvolutionFwdSignatureKey key6{
|
|
DataType::HALF, DataType::FLOAT, DataType::HALF, DataType::FLOAT};
|
|
EXPECT_FALSE(key5 == key6);
|
|
|
|
const GpuConvolutionFwdSignatureKey key7{
|
|
DataType::FLOAT, DataType::FLOAT, DataType::FLOAT, DataType::FLOAT};
|
|
const GpuConvolutionFwdSignatureKey key8{
|
|
DataType::FLOAT, DataType::HALF, DataType::FLOAT, DataType::FLOAT};
|
|
EXPECT_FALSE(key7 == key8);
|
|
}
|
|
|
|
TEST(TestGpuConvolutionFwdSignatureKey, HashFunction)
|
|
{
|
|
const GpuConvolutionFwdSignatureKey key1{
|
|
DataType::FLOAT, DataType::FLOAT, DataType::FLOAT, DataType::FLOAT};
|
|
const GpuConvolutionFwdSignatureKey key2{
|
|
DataType::FLOAT, DataType::FLOAT, DataType::FLOAT, DataType::FLOAT};
|
|
|
|
EXPECT_EQ(key1.hashSelf(), key2.hashSelf());
|
|
|
|
const GpuConvolutionFwdSignatureKey key3{
|
|
DataType::HALF, DataType::FLOAT, DataType::FLOAT, DataType::HALF};
|
|
const GpuConvolutionFwdSignatureKey key4{
|
|
DataType::FLOAT, DataType::HALF, DataType::FLOAT, DataType::FLOAT};
|
|
const GpuConvolutionFwdSignatureKey key5{
|
|
DataType::FLOAT, DataType::FLOAT, DataType::HALF, DataType::FLOAT};
|
|
|
|
auto hash3 = key3.hashSelf();
|
|
auto hash4 = key4.hashSelf();
|
|
auto hash5 = key5.hashSelf();
|
|
|
|
EXPECT_TRUE(hash3 != hash4 && hash3 != hash5 && hash4 != hash5);
|
|
}
|
|
|
|
TEST(TestGpuConvolutionFwdSignatureKey, Copy)
|
|
{
|
|
const GpuConvolutionFwdSignatureKey original{
|
|
DataType::BFLOAT16, DataType::FLOAT, DataType::FLOAT, DataType::HALF};
|
|
const GpuConvolutionFwdSignatureKey copied{original};
|
|
|
|
EXPECT_TRUE(original == copied);
|
|
EXPECT_EQ(copied.xDataType, DataType::BFLOAT16);
|
|
EXPECT_EQ(copied.wDataType, DataType::FLOAT);
|
|
EXPECT_EQ(copied.outputDataType, DataType::FLOAT);
|
|
EXPECT_EQ(copied.computeDataType, DataType::HALF);
|
|
}
|
|
|
|
TEST(TestGpuConvolutionFwdSignatureKey, CreateFromNodeAndTensorMap)
|
|
{
|
|
constexpr int64_t X_UID = 10;
|
|
constexpr int64_t W_UID = 11;
|
|
constexpr int64_t Y_UID = 12;
|
|
|
|
const std::vector<int64_t> xDims = {1, 1, 2, 2};
|
|
const std::vector<int64_t> wDims = {1, 1, 1, 1};
|
|
const std::vector<int64_t> yDims = {1, 1, 2, 2};
|
|
|
|
auto graphBuilder = createConvFwdGraph(X_UID,
|
|
W_UID,
|
|
Y_UID,
|
|
xDims,
|
|
wDims,
|
|
yDims,
|
|
generateStrides(xDims),
|
|
generateStrides(wDims),
|
|
generateStrides(yDims),
|
|
{0, 0},
|
|
{1, 1},
|
|
{1, 1},
|
|
DataType::FLOAT);
|
|
|
|
auto graphWrap = hipdnn_flatbuffers_sdk::flatbuffer_utilities::GraphWrapper(
|
|
graphBuilder.GetBufferPointer(), graphBuilder.GetSize());
|
|
|
|
const GpuConvolutionFwdSignatureKey keyFromNode(
|
|
graphWrap.getNode(0), graphWrap.getTensorMap(), DataType::FLOAT);
|
|
|
|
const GpuConvolutionFwdSignatureKey expectedKey{
|
|
DataType::FLOAT, DataType::FLOAT, DataType::FLOAT, DataType::FLOAT};
|
|
|
|
EXPECT_TRUE(keyFromNode == expectedKey);
|
|
}
|