// Copyright Advanced Micro Devices, Inc., or its affiliates. // SPDX-License-Identifier: MIT #include #include #include #include #include namespace rocRoller { ScheduledInstructions::ScheduledInstructions(ContextPtr ctx) : m_context(ctx) { } void ScheduledInstructions::clear() { m_instructionstream = std::ostringstream(); } std::shared_ptr ScheduledInstructions::getExecutableKernel() { auto context = m_context.lock(); auto target = context->targetArchitecture().target(); std::shared_ptr result = std::make_shared(target); result->loadKernel(toString(), target, context->kernel()->kernelName()); return result; } std::string ScheduledInstructions::toString() const { return m_instructionstream.str(); } std::vector ScheduledInstructions::assemble() const { auto context = m_context.lock(); auto assembler = Assembler::Get(); return assembler->assembleMachineCode( toString(), context->targetArchitecture().target(), context->kernel()->kernelName()); } void ScheduledInstructions::schedule(const Instruction& instruction) { auto context = m_context.lock(); instruction.toStream(m_instructionstream, context->kernelOptions()->logLevel); } }