Files
TheRock/rocm-systems/emulation/rocjitsu/tests/isa_registry_composition_test.cpp
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

51 lines
1.7 KiB
C++

// Copyright (c) 2026 Advanced Micro Devices, Inc.
// SPDX-License-Identifier: MIT
/// @file isa_registry_composition_test.cpp
/// @brief Multi-component static ISA registry composition tests.
#include "rocjitsu/isa/decoder.h"
#include "rocjitsu/isa/instruction.h"
#include "rocjitsu/isa/target_registry.h"
#include <gtest/gtest.h>
#include <cstddef>
#include <cstdint>
#include <memory>
extern "C" size_t rj_test_narrow_target_count();
extern "C" bool rj_test_narrow_has_target(const char *id);
extern "C" size_t rj_test_downstream_target_count();
extern "C" bool rj_test_downstream_has_target(const char *id);
namespace {
TEST(IsaRegistryCompositionTest, ComponentsKeepIndependentStaticSubsets) {
using namespace rocjitsu;
const IsaTargetRegistry &full = default_isa_target_registry();
const IsaTargetDescriptor *full_gfx1250 = full.find("gfx1250");
ASSERT_NE(full_gfx1250, nullptr);
EXPECT_TRUE(full_gfx1250->supports_execution);
constexpr uint32_t kSNop = 0xBF800000u;
std::unique_ptr<Decoder> full_decoder = Decoder::create(full, "gfx1250");
ASSERT_NE(full_decoder, nullptr);
std::unique_ptr<Instruction> full_instruction(full_decoder->decode(&kSNop));
ASSERT_NE(full_instruction, nullptr);
EXPECT_NE(full_instruction->execute, nullptr);
ASSERT_EQ(rj_test_narrow_target_count(), 1u);
EXPECT_TRUE(rj_test_narrow_has_target("gfx1250"));
EXPECT_FALSE(rj_test_narrow_has_target("rdna4"));
EXPECT_FALSE(rj_test_narrow_has_target("vendor-downstream-test"));
ASSERT_EQ(rj_test_downstream_target_count(), 1u);
EXPECT_TRUE(rj_test_downstream_has_target("vendor-downstream-test"));
EXPECT_FALSE(rj_test_downstream_has_target("gfx1250"));
EXPECT_EQ(full.find("vendor-downstream-test"), nullptr);
}
} // namespace