// Copyright Advanced Micro Devices, Inc., or its affiliates. // SPDX-License-Identifier: MIT #include #include #include #include #include "GenericContextFixture.hpp" #include "SourceMatcher.hpp" using namespace rocRoller; namespace rocRollerTest { class SupportedInstructionObserverTest : public GenericContextFixture { protected: GPUArchitectureTarget targetArchitecture() override { return {GPUArchitectureGFX::GFX90A}; } }; TEST_F(SupportedInstructionObserverTest, KnownInstruction) { auto inst = Instruction("s_barrier", {}, {}, {}, ""); m_context->schedule(inst); } TEST_F(SupportedInstructionObserverTest, Comments) { auto inst = Instruction::Comment("Test Comment"); m_context->schedule(inst); } TEST_F(SupportedInstructionObserverTest, UnknownInstruction) { auto inst = Instruction("unknown_instruction", {}, {}, {}, ""); EXPECT_THROW(m_context->schedule(inst), FatalError); } class SupportedInstructionObserverOffTest : public GenericContextFixture { protected: GPUArchitectureTarget targetArchitecture() override { return {GPUArchitectureGFX::GFX90A}; } void SetUp() override { Settings::getInstance()->set(Settings::AllowUnknownInstructions, true); GenericContextFixture::SetUp(); } }; TEST_F(SupportedInstructionObserverOffTest, KnownInstruction) { auto inst = Instruction("s_barrier", {}, {}, {}, ""); m_context->schedule(inst); } TEST_F(SupportedInstructionObserverOffTest, Comments) { auto inst = Instruction::Comment("Test Comment"); m_context->schedule(inst); } TEST_F(SupportedInstructionObserverOffTest, UnknownInstruction) { auto inst = Instruction("unknown_instruction", {}, {}, {}, ""); m_context->schedule(inst); } }