/******************************************************************************* * * MIT License * * Copyright 2024-2025 AMD ROCm(TM) Software * * 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. * *******************************************************************************/ #pragma once #include #include #include #include #include #include namespace rocRoller { inline Scheduling::InstructionStatus Context::peek(Instruction const& inst) { return m_observer->peek(inst); } inline void Context::schedule(Instruction& inst) { auto status = m_observer->peek(inst); inst.setPeekedStatus(std::move(status)); m_observer->modify(inst); m_observer->observe(inst); m_instructions->schedule(inst); } template inline void Context::schedule(T const& insts) { for(Instruction const& inst : insts) { scheduleCopy(inst); } } template inline void Context::schedule(T&& insts) { for(Instruction const& inst : insts) { scheduleCopy(inst); } } inline std::shared_ptr Context::allocator(Register::Type registerType) { return m_allocators.at(static_cast(registerType)); } inline LabelAllocatorPtr Context::labelAllocator() const { return m_labelAllocator; } inline std::shared_ptr Context::ldsAllocator() const { return m_ldsAllocator; } inline GPUArchitecture const& Context::targetArchitecture() const { return m_targetArch; } inline int Context::hipDeviceIndex() const { return m_hipDeviceIdx; } inline std::shared_ptr Context::observer() const { return m_observer; } inline AssemblyKernelPtr Context::kernel() const { return m_kernel; } inline std::shared_ptr Context::argLoader() const { return m_argLoader; } inline std::shared_ptr Context::instructions() const { return m_instructions; } inline std::shared_ptr Context::mem() const { return m_mem; } inline std::shared_ptr Context::copier() const { return m_copier; } inline std::shared_ptr Context::brancher() const { return m_brancher; } inline std::shared_ptr Context::crasher() const { return m_crasher; } inline std::shared_ptr Context::random() const { return m_random; } inline KernelOptions const& Context::kernelOptions() { return m_kernelOptions; } inline std::string Context::assemblyFileName() const { return m_assemblyFileName; } inline RegTagManPtr Context::registerTagManager() const { return m_registerTagMan; } }