spb/forge Public MIT
Forge — LLM training from scratch in pure C++20 + Metal on Apple Silicon.
C++ 61.2%
C 23%
Python 7.6%
TeX 7.2%
CMake 1.1%
1//-------------------------------------------------------------------------------------------------------------------------------------------------------------2//3// Metal/MTLCaptureScope.hpp4//5// Copyright 2020-2024 Apple Inc.6//7// Licensed under the Apache License, Version 2.0 (the "License");8// you may not use this file except in compliance with the License.9// You may obtain a copy of the License at10//11// http://www.apache.org/licenses/LICENSE-2.012//13// Unless required by applicable law or agreed to in writing, software14// distributed under the License is distributed on an "AS IS" BASIS,15// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.16// See the License for the specific language governing permissions and17// limitations under the License.18//19//-------------------------------------------------------------------------------------------------------------------------------------------------------------2021#pragma once2223//-------------------------------------------------------------------------------------------------------------------------------------------------------------2425#include "MTLDefines.hpp"26#include "MTLPrivate.hpp"2728#include "../Foundation/Foundation.hpp"2930//-------------------------------------------------------------------------------------------------------------------------------------------------------------3132namespace MTL33{34class CaptureScope : public NS::Referencing<CaptureScope>35{36public:37 class Device* device() const;3839 NS::String* label() const;40 void setLabel(const NS::String* pLabel);4142 class CommandQueue* commandQueue() const;4344 void beginScope();45 void endScope();46};47}4849//-------------------------------------------------------------------------------------------------------------------------------------------------------------5051_MTL_INLINE MTL::Device* MTL::CaptureScope::device() const52{53 return Object::sendMessage<Device*>(this, _MTL_PRIVATE_SEL(device));54}5556//-------------------------------------------------------------------------------------------------------------------------------------------------------------5758_MTL_INLINE NS::String* MTL::CaptureScope::label() const59{60 return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));61}6263//-------------------------------------------------------------------------------------------------------------------------------------------------------------6465_MTL_INLINE void MTL::CaptureScope::setLabel(const NS::String* pLabel)66{67 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), pLabel);68}6970//-------------------------------------------------------------------------------------------------------------------------------------------------------------7172_MTL_INLINE MTL::CommandQueue* MTL::CaptureScope::commandQueue() const73{74 return Object::sendMessage<CommandQueue*>(this, _MTL_PRIVATE_SEL(commandQueue));75}7677//-------------------------------------------------------------------------------------------------------------------------------------------------------------7879_MTL_INLINE void MTL::CaptureScope::beginScope()80{81 return Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(beginScope));82}8384//-------------------------------------------------------------------------------------------------------------------------------------------------------------8586_MTL_INLINE void MTL::CaptureScope::endScope()87{88 return Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(endScope));89}9091//-------------------------------------------------------------------------------------------------------------------------------------------------------------92