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/MTLFunctionLog.hpp4//5// Copyright 2020-2025 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#include "../Foundation/Foundation.hpp"24#include "MTLDefines.hpp"25#include "MTLHeaderBridge.hpp"26#include "MTLPrivate.hpp"2728namespace MTL29{30class Function;31class FunctionLogDebugLocation;32_MTL_ENUM(NS::UInteger, FunctionLogType) {33 FunctionLogTypeValidation = 0,34};3536class LogContainer : public NS::Referencing<LogContainer, NS::FastEnumeration>37{38};39class FunctionLogDebugLocation : public NS::Referencing<FunctionLogDebugLocation>40{41public:42 NS::URL* URL() const;4344 NS::UInteger column() const;4546 NS::String* functionName() const;4748 NS::UInteger line() const;49};50class FunctionLog : public NS::Referencing<FunctionLog>51{52public:53 FunctionLogDebugLocation* debugLocation() const;5455 NS::String* encoderLabel() const;5657 Function* function() const;5859 FunctionLogType type() const;60};6162}63_MTL_INLINE NS::URL* MTL::FunctionLogDebugLocation::URL() const64{65 return Object::sendMessage<NS::URL*>(this, _MTL_PRIVATE_SEL(URL));66}6768_MTL_INLINE NS::UInteger MTL::FunctionLogDebugLocation::column() const69{70 return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(column));71}7273_MTL_INLINE NS::String* MTL::FunctionLogDebugLocation::functionName() const74{75 return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(functionName));76}7778_MTL_INLINE NS::UInteger MTL::FunctionLogDebugLocation::line() const79{80 return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(line));81}8283_MTL_INLINE MTL::FunctionLogDebugLocation* MTL::FunctionLog::debugLocation() const84{85 return Object::sendMessage<MTL::FunctionLogDebugLocation*>(this, _MTL_PRIVATE_SEL(debugLocation));86}8788_MTL_INLINE NS::String* MTL::FunctionLog::encoderLabel() const89{90 return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(encoderLabel));91}9293_MTL_INLINE MTL::Function* MTL::FunctionLog::function() const94{95 return Object::sendMessage<MTL::Function*>(this, _MTL_PRIVATE_SEL(function));96}9798_MTL_INLINE MTL::FunctionLogType MTL::FunctionLog::type() const99{100 return Object::sendMessage<MTL::FunctionLogType>(this, _MTL_PRIVATE_SEL(type));101}102