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/MTL4SpecializedFunctionDescriptor.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 "MTL4FunctionDescriptor.hpp"25#include "MTLDefines.hpp"26#include "MTLHeaderBridge.hpp"27#include "MTLPrivate.hpp"2829namespace MTL430{31class FunctionDescriptor;32class SpecializedFunctionDescriptor;33}3435namespace MTL36{37class FunctionConstantValues;38}3940namespace MTL441{42class SpecializedFunctionDescriptor : public NS::Copying<SpecializedFunctionDescriptor, FunctionDescriptor>43{44public:45 static SpecializedFunctionDescriptor* alloc();4647 MTL::FunctionConstantValues* constantValues() const;4849 FunctionDescriptor* functionDescriptor() const;5051 SpecializedFunctionDescriptor* init();5253 void setConstantValues(const MTL::FunctionConstantValues* constantValues);5455 void setFunctionDescriptor(const MTL4::FunctionDescriptor* functionDescriptor);5657 void setSpecializedName(const NS::String* specializedName);58 NS::String* specializedName() const;59};6061}62_MTL_INLINE MTL4::SpecializedFunctionDescriptor* MTL4::SpecializedFunctionDescriptor::alloc()63{64 return NS::Object::alloc<MTL4::SpecializedFunctionDescriptor>(_MTL_PRIVATE_CLS(MTL4SpecializedFunctionDescriptor));65}6667_MTL_INLINE MTL::FunctionConstantValues* MTL4::SpecializedFunctionDescriptor::constantValues() const68{69 return Object::sendMessage<MTL::FunctionConstantValues*>(this, _MTL_PRIVATE_SEL(constantValues));70}7172_MTL_INLINE MTL4::FunctionDescriptor* MTL4::SpecializedFunctionDescriptor::functionDescriptor() const73{74 return Object::sendMessage<MTL4::FunctionDescriptor*>(this, _MTL_PRIVATE_SEL(functionDescriptor));75}7677_MTL_INLINE MTL4::SpecializedFunctionDescriptor* MTL4::SpecializedFunctionDescriptor::init()78{79 return NS::Object::init<MTL4::SpecializedFunctionDescriptor>();80}8182_MTL_INLINE void MTL4::SpecializedFunctionDescriptor::setConstantValues(const MTL::FunctionConstantValues* constantValues)83{84 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setConstantValues_), constantValues);85}8687_MTL_INLINE void MTL4::SpecializedFunctionDescriptor::setFunctionDescriptor(const MTL4::FunctionDescriptor* functionDescriptor)88{89 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFunctionDescriptor_), functionDescriptor);90}9192_MTL_INLINE void MTL4::SpecializedFunctionDescriptor::setSpecializedName(const NS::String* specializedName)93{94 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSpecializedName_), specializedName);95}9697_MTL_INLINE NS::String* MTL4::SpecializedFunctionDescriptor::specializedName() const98{99 return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(specializedName));100}101