/ include / Metal / MTLFunctionStitching.hpp
MTLFunctionStitching.hpp
  1  //-------------------------------------------------------------------------------------------------------------------------------------------------------------
  2  //
  3  // Metal/MTLFunctionStitching.hpp
  4  //
  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 at
 10  //
 11  //     http://www.apache.org/licenses/LICENSE-2.0
 12  //
 13  // Unless required by applicable law or agreed to in writing, software
 14  // 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 and
 17  // limitations under the License.
 18  //
 19  //-------------------------------------------------------------------------------------------------------------------------------------------------------------
 20  
 21  #pragma once
 22  
 23  #include "MTLDefines.hpp"
 24  #include "MTLHeaderBridge.hpp"
 25  #include "MTLPrivate.hpp"
 26  
 27  #include <Foundation/Foundation.hpp>
 28  
 29  #include "MTLFunctionStitching.hpp"
 30  
 31  namespace MTL
 32  {
 33  _MTL_OPTIONS(NS::UInteger, StitchedLibraryOptions) {
 34      StitchedLibraryOptionNone = 0,
 35      StitchedLibraryOptionFailOnBinaryArchiveMiss = 1,
 36      StitchedLibraryOptionStoreLibraryInMetalScript = 2,
 37      StitchedLibraryOptionStoreLibraryInMetalPipelinesScript = 2
 38  };
 39  
 40  class FunctionStitchingAttribute : public NS::Referencing<FunctionStitchingAttribute>
 41  {
 42  public:
 43  };
 44  
 45  class FunctionStitchingAttributeAlwaysInline : public NS::Referencing<FunctionStitchingAttributeAlwaysInline, FunctionStitchingAttribute>
 46  {
 47  public:
 48      static class FunctionStitchingAttributeAlwaysInline* alloc();
 49  
 50      class FunctionStitchingAttributeAlwaysInline*        init();
 51  };
 52  
 53  class FunctionStitchingNode : public NS::Copying<FunctionStitchingNode>
 54  {
 55  public:
 56  };
 57  
 58  class FunctionStitchingInputNode : public NS::Referencing<FunctionStitchingInputNode, FunctionStitchingNode>
 59  {
 60  public:
 61      static class FunctionStitchingInputNode* alloc();
 62  
 63      class FunctionStitchingInputNode*        init();
 64  
 65      NS::UInteger                             argumentIndex() const;
 66      void                                     setArgumentIndex(NS::UInteger argumentIndex);
 67  
 68      MTL::FunctionStitchingInputNode*         init(NS::UInteger argument);
 69  };
 70  
 71  class FunctionStitchingFunctionNode : public NS::Referencing<FunctionStitchingFunctionNode, FunctionStitchingNode>
 72  {
 73  public:
 74      static class FunctionStitchingFunctionNode* alloc();
 75  
 76      class FunctionStitchingFunctionNode*        init();
 77  
 78      NS::String*                                 name() const;
 79      void                                        setName(const NS::String* name);
 80  
 81      NS::Array*                                  arguments() const;
 82      void                                        setArguments(const NS::Array* arguments);
 83  
 84      NS::Array*                                  controlDependencies() const;
 85      void                                        setControlDependencies(const NS::Array* controlDependencies);
 86  
 87      MTL::FunctionStitchingFunctionNode*         init(const NS::String* name, const NS::Array* arguments, const NS::Array* controlDependencies);
 88  };
 89  
 90  class FunctionStitchingGraph : public NS::Copying<FunctionStitchingGraph>
 91  {
 92  public:
 93      static class FunctionStitchingGraph* alloc();
 94  
 95      class FunctionStitchingGraph*        init();
 96  
 97      NS::String*                          functionName() const;
 98      void                                 setFunctionName(const NS::String* functionName);
 99  
100      NS::Array*                           nodes() const;
101      void                                 setNodes(const NS::Array* nodes);
102  
103      class FunctionStitchingFunctionNode* outputNode() const;
104      void                                 setOutputNode(const class FunctionStitchingFunctionNode* outputNode);
105  
106      NS::Array*                           attributes() const;
107      void                                 setAttributes(const NS::Array* attributes);
108  
109      MTL::FunctionStitchingGraph*         init(const NS::String* functionName, const NS::Array* nodes, const class FunctionStitchingFunctionNode* outputNode, const NS::Array* attributes);
110  };
111  
112  class StitchedLibraryDescriptor : public NS::Copying<StitchedLibraryDescriptor>
113  {
114  public:
115      static class StitchedLibraryDescriptor* alloc();
116  
117      class StitchedLibraryDescriptor*        init();
118  
119      NS::Array*                              functionGraphs() const;
120      void                                    setFunctionGraphs(const NS::Array* functionGraphs);
121  
122      NS::Array*                              functions() const;
123      void                                    setFunctions(const NS::Array* functions);
124  
125      NS::Array*                              binaryArchives() const;
126      void                                    setBinaryArchives(const NS::Array* binaryArchives);
127  
128      MTL::StitchedLibraryOptions             options() const;
129      void                                    setOptions(MTL::StitchedLibraryOptions options);
130  };
131  
132  }
133  
134  // static method: alloc
135  _MTL_INLINE MTL::FunctionStitchingAttributeAlwaysInline* MTL::FunctionStitchingAttributeAlwaysInline::alloc()
136  {
137      return NS::Object::alloc<MTL::FunctionStitchingAttributeAlwaysInline>(_MTL_PRIVATE_CLS(MTLFunctionStitchingAttributeAlwaysInline));
138  }
139  
140  // method: init
141  _MTL_INLINE MTL::FunctionStitchingAttributeAlwaysInline* MTL::FunctionStitchingAttributeAlwaysInline::init()
142  {
143      return NS::Object::init<MTL::FunctionStitchingAttributeAlwaysInline>();
144  }
145  
146  // static method: alloc
147  _MTL_INLINE MTL::FunctionStitchingInputNode* MTL::FunctionStitchingInputNode::alloc()
148  {
149      return NS::Object::alloc<MTL::FunctionStitchingInputNode>(_MTL_PRIVATE_CLS(MTLFunctionStitchingInputNode));
150  }
151  
152  // method: init
153  _MTL_INLINE MTL::FunctionStitchingInputNode* MTL::FunctionStitchingInputNode::init()
154  {
155      return NS::Object::init<MTL::FunctionStitchingInputNode>();
156  }
157  
158  // property: argumentIndex
159  _MTL_INLINE NS::UInteger MTL::FunctionStitchingInputNode::argumentIndex() const
160  {
161      return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(argumentIndex));
162  }
163  
164  _MTL_INLINE void MTL::FunctionStitchingInputNode::setArgumentIndex(NS::UInteger argumentIndex)
165  {
166      Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setArgumentIndex_), argumentIndex);
167  }
168  
169  // method: initWithArgumentIndex:
170  _MTL_INLINE MTL::FunctionStitchingInputNode* MTL::FunctionStitchingInputNode::init(NS::UInteger argument)
171  {
172      return Object::sendMessage<MTL::FunctionStitchingInputNode*>(this, _MTL_PRIVATE_SEL(initWithArgumentIndex_), argument);
173  }
174  
175  // static method: alloc
176  _MTL_INLINE MTL::FunctionStitchingFunctionNode* MTL::FunctionStitchingFunctionNode::alloc()
177  {
178      return NS::Object::alloc<MTL::FunctionStitchingFunctionNode>(_MTL_PRIVATE_CLS(MTLFunctionStitchingFunctionNode));
179  }
180  
181  // method: init
182  _MTL_INLINE MTL::FunctionStitchingFunctionNode* MTL::FunctionStitchingFunctionNode::init()
183  {
184      return NS::Object::init<MTL::FunctionStitchingFunctionNode>();
185  }
186  
187  // property: name
188  _MTL_INLINE NS::String* MTL::FunctionStitchingFunctionNode::name() const
189  {
190      return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
191  }
192  
193  _MTL_INLINE void MTL::FunctionStitchingFunctionNode::setName(const NS::String* name)
194  {
195      Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setName_), name);
196  }
197  
198  // property: arguments
199  _MTL_INLINE NS::Array* MTL::FunctionStitchingFunctionNode::arguments() const
200  {
201      return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(arguments));
202  }
203  
204  _MTL_INLINE void MTL::FunctionStitchingFunctionNode::setArguments(const NS::Array* arguments)
205  {
206      Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setArguments_), arguments);
207  }
208  
209  // property: controlDependencies
210  _MTL_INLINE NS::Array* MTL::FunctionStitchingFunctionNode::controlDependencies() const
211  {
212      return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(controlDependencies));
213  }
214  
215  _MTL_INLINE void MTL::FunctionStitchingFunctionNode::setControlDependencies(const NS::Array* controlDependencies)
216  {
217      Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setControlDependencies_), controlDependencies);
218  }
219  
220  // method: initWithName:arguments:controlDependencies:
221  _MTL_INLINE MTL::FunctionStitchingFunctionNode* MTL::FunctionStitchingFunctionNode::init(const NS::String* name, const NS::Array* arguments, const NS::Array* controlDependencies)
222  {
223      return Object::sendMessage<MTL::FunctionStitchingFunctionNode*>(this, _MTL_PRIVATE_SEL(initWithName_arguments_controlDependencies_), name, arguments, controlDependencies);
224  }
225  
226  // static method: alloc
227  _MTL_INLINE MTL::FunctionStitchingGraph* MTL::FunctionStitchingGraph::alloc()
228  {
229      return NS::Object::alloc<MTL::FunctionStitchingGraph>(_MTL_PRIVATE_CLS(MTLFunctionStitchingGraph));
230  }
231  
232  // method: init
233  _MTL_INLINE MTL::FunctionStitchingGraph* MTL::FunctionStitchingGraph::init()
234  {
235      return NS::Object::init<MTL::FunctionStitchingGraph>();
236  }
237  
238  // property: functionName
239  _MTL_INLINE NS::String* MTL::FunctionStitchingGraph::functionName() const
240  {
241      return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(functionName));
242  }
243  
244  _MTL_INLINE void MTL::FunctionStitchingGraph::setFunctionName(const NS::String* functionName)
245  {
246      Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFunctionName_), functionName);
247  }
248  
249  // property: nodes
250  _MTL_INLINE NS::Array* MTL::FunctionStitchingGraph::nodes() const
251  {
252      return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(nodes));
253  }
254  
255  _MTL_INLINE void MTL::FunctionStitchingGraph::setNodes(const NS::Array* nodes)
256  {
257      Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setNodes_), nodes);
258  }
259  
260  // property: outputNode
261  _MTL_INLINE MTL::FunctionStitchingFunctionNode* MTL::FunctionStitchingGraph::outputNode() const
262  {
263      return Object::sendMessage<MTL::FunctionStitchingFunctionNode*>(this, _MTL_PRIVATE_SEL(outputNode));
264  }
265  
266  _MTL_INLINE void MTL::FunctionStitchingGraph::setOutputNode(const MTL::FunctionStitchingFunctionNode* outputNode)
267  {
268      Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOutputNode_), outputNode);
269  }
270  
271  // property: attributes
272  _MTL_INLINE NS::Array* MTL::FunctionStitchingGraph::attributes() const
273  {
274      return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(attributes));
275  }
276  
277  _MTL_INLINE void MTL::FunctionStitchingGraph::setAttributes(const NS::Array* attributes)
278  {
279      Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setAttributes_), attributes);
280  }
281  
282  // method: initWithFunctionName:nodes:outputNode:attributes:
283  _MTL_INLINE MTL::FunctionStitchingGraph* MTL::FunctionStitchingGraph::init(const NS::String* functionName, const NS::Array* nodes, const MTL::FunctionStitchingFunctionNode* outputNode, const NS::Array* attributes)
284  {
285      return Object::sendMessage<MTL::FunctionStitchingGraph*>(this, _MTL_PRIVATE_SEL(initWithFunctionName_nodes_outputNode_attributes_), functionName, nodes, outputNode, attributes);
286  }
287  
288  // static method: alloc
289  _MTL_INLINE MTL::StitchedLibraryDescriptor* MTL::StitchedLibraryDescriptor::alloc()
290  {
291      return NS::Object::alloc<MTL::StitchedLibraryDescriptor>(_MTL_PRIVATE_CLS(MTLStitchedLibraryDescriptor));
292  }
293  
294  // method: init
295  _MTL_INLINE MTL::StitchedLibraryDescriptor* MTL::StitchedLibraryDescriptor::init()
296  {
297      return NS::Object::init<MTL::StitchedLibraryDescriptor>();
298  }
299  
300  // property: functionGraphs
301  _MTL_INLINE NS::Array* MTL::StitchedLibraryDescriptor::functionGraphs() const
302  {
303      return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(functionGraphs));
304  }
305  
306  _MTL_INLINE void MTL::StitchedLibraryDescriptor::setFunctionGraphs(const NS::Array* functionGraphs)
307  {
308      Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFunctionGraphs_), functionGraphs);
309  }
310  
311  // property: functions
312  _MTL_INLINE NS::Array* MTL::StitchedLibraryDescriptor::functions() const
313  {
314      return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(functions));
315  }
316  
317  _MTL_INLINE void MTL::StitchedLibraryDescriptor::setFunctions(const NS::Array* functions)
318  {
319      Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFunctions_), functions);
320  }
321  
322  // property: binaryArchives
323  _MTL_INLINE NS::Array* MTL::StitchedLibraryDescriptor::binaryArchives() const
324  {
325      return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(binaryArchives));
326  }
327  
328  _MTL_INLINE void MTL::StitchedLibraryDescriptor::setBinaryArchives(const NS::Array* binaryArchives)
329  {
330      Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBinaryArchives_), binaryArchives);
331  }
332  
333  // property: options
334  _MTL_INLINE MTL::StitchedLibraryOptions MTL::StitchedLibraryDescriptor::options() const
335  {
336      return Object::sendMessage<MTL::StitchedLibraryOptions>(this, _MTL_PRIVATE_SEL(options));
337  }
338  
339  _MTL_INLINE void MTL::StitchedLibraryDescriptor::setOptions(MTL::StitchedLibraryOptions options)
340  {
341      Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOptions_), options);
342  }