Comments (5)
This would be useful if we had a good C++ FFI. Without it, you'd probably end up writing shims anyway.
from metal.jl.
It's something to keep in mind though, so it doesn't hurt to let this open.
from metal.jl.
I had a brief look at using SWIG with the experimental C back-end from swig/swig#2086, but ran into a few problems. Documenting those here:
- SWIG doesn't handle
_MTL_INLINE
(but we cansed
that away) - callbacks are blocks, not ordinary function pointers: https://en.wikipedia.org/wiki/Blocks_(C_language_extension). Maybe we can treat those without captures like ordinary function pointers (i.e. remove the
(^)
), but not all (e.g.newBuffer(const void* pointer, NS::UInteger length, MTL::ResourceOptions options, void (^deallocator)(void*, NS::UInteger))
)
metal-cpp/Metal.i
%module MTL
%{
#define NS_PRIVATE_IMPLEMENTATION
#define CA_PRIVATE_IMPLEMENTATION
#define MTL_PRIVATE_IMPLEMENTATION
#include <Metal/Metal.hpp>
%}
// includes taken from Metal.hpp (-includeall works too,
// but includes too much, like system headers)
#define NS_PRIVATE_IMPLEMENTATION
#define CA_PRIVATE_IMPLEMENTATION
#define MTL_PRIVATE_IMPLEMENTATION
%include "MTLAccelerationStructure.hpp"
%include "MTLAccelerationStructureCommandEncoder.hpp"
%include "MTLAccelerationStructureTypes.hpp"
%include "MTLArgument.hpp"
%include "MTLArgumentEncoder.hpp"
%include "MTLBinaryArchive.hpp"
%include "MTLBlitCommandEncoder.hpp"
%include "MTLBlitPass.hpp"
%include "MTLBuffer.hpp"
%include "MTLCaptureManager.hpp"
%include "MTLCaptureScope.hpp"
%include "MTLCommandBuffer.hpp"
%include "MTLCommandEncoder.hpp"
%include "MTLCommandQueue.hpp"
%include "MTLComputeCommandEncoder.hpp"
%include "MTLComputePass.hpp"
%include "MTLComputePipeline.hpp"
%include "MTLCounters.hpp"
%include "MTLDefines.hpp"
%include "MTLDepthStencil.hpp"
%include "MTLDevice.hpp"
%include "MTLDrawable.hpp"
%include "MTLDynamicLibrary.hpp"
%include "MTLEvent.hpp"
%include "MTLFence.hpp"
%include "MTLFunctionConstantValues.hpp"
%include "MTLFunctionDescriptor.hpp"
%include "MTLFunctionHandle.hpp"
%include "MTLFunctionLog.hpp"
%include "MTLFunctionStitching.hpp"
%include "MTLHeaderBridge.hpp"
%include "MTLHeap.hpp"
%include "MTLIndirectCommandBuffer.hpp"
%include "MTLIndirectCommandEncoder.hpp"
%include "MTLIntersectionFunctionTable.hpp"
%include "MTLIOCommandBuffer.hpp"
%include "MTLIOCommandQueue.hpp"
%include "MTLIOCompressor.hpp"
%include "MTLLibrary.hpp"
%include "MTLLinkedFunctions.hpp"
%include "MTLParallelRenderCommandEncoder.hpp"
%include "MTLPipeline.hpp"
%include "MTLPixelFormat.hpp"
%include "MTLPrivate.hpp"
%include "MTLRasterizationRate.hpp"
%include "MTLRenderCommandEncoder.hpp"
%include "MTLRenderPass.hpp"
%include "MTLRenderPipeline.hpp"
%include "MTLResource.hpp"
%include "MTLResourceStateCommandEncoder.hpp"
%include "MTLResourceStatePass.hpp"
%include "MTLSampler.hpp"
%include "MTLStageInputOutputDescriptor.hpp"
%include "MTLTexture.hpp"
%include "MTLTypes.hpp"
%include "MTLVertexDescriptor.hpp"
%include "MTLVisibleFunctionTable.hpp"
%include "MTLVersion.hpp"
swig -Imetal-cpp/Metal -c++ -c metal-cpp/Metal.i
from metal.jl.
Does #117 close this issue?
from metal.jl.
Yeah, thanks.
from metal.jl.
Related Issues (20)
- tag new version HOT 1
- Panic during profiling tests on 14.4 beta HOT 5
- M3 backend cannot handle atomics with complicated pointer conversions HOT 3
- Int128 does not compile HOT 4
- Two suspicious `mtl`-related behaviours HOT 6
- Add Support for BFloat16 HOT 3
- LU factorization: add allowsingular keyword argument HOT 1
- Autorelease changes lead to use after free with errors
- Shader validator error with linear broadcast kernel HOT 3
- Support for Paravirtualized Graphics for Github Actions CI HOT 4
- Reductions don't work on Shared Arrays HOT 1
- Port the opportunistic synchronization from CUDA.jl HOT 1
- Register v1.1.0 HOT 4
- Tests sporadically timing out on 1.11 HOT 9
- ReshapedArray indexing broken because of Int128 operation HOT 11
- KernelAbstractions copyto! typo
- Segmentation Faults HOT 11
- Port `accmulate!` and `findall` from CUDA.jl HOT 4
- `MTL.append_copy!` silently ignores Metal documentation restriction HOT 2
- Tests failing with `GPUCompiler` v0.26.5 and `LLVM` v7.1 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from metal.jl.