Skip to content

Commit

Permalink
Add generated MPS enums and structs
Browse files Browse the repository at this point in the history
  • Loading branch information
christiangnrd committed Dec 10, 2024
1 parent 5ebc3be commit 4b4ed49
Show file tree
Hide file tree
Showing 9 changed files with 710 additions and 86 deletions.
3 changes: 3 additions & 0 deletions lib/mps/MPS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ const MtlFloat = Union{Float32, Float16}

is_supported(dev::MTLDevice) = ccall(:MPSSupportsMTLDevice, Bool, (id{MTLDevice},), dev)

# Load in generated enums and structs
include("libmps.jl")

include("size.jl")

# high-level wrappers
Expand Down
12 changes: 6 additions & 6 deletions lib/mps/copy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

export MPSMatrixCopyDescriptor

struct MPSMatrixCopyOffsets
sourceRowOffset::Cuint
sourceColumnOffset::Cuint
destinationRowOffset::Cuint
destinationColumnOffset::Cuint
end
# struct MPSMatrixCopyOffsets
# sourceRowOffset::Cuint
# sourceColumnOffset::Cuint
# destinationRowOffset::Cuint
# destinationColumnOffset::Cuint
# end

@objcwrapper MPSMatrixCopyDescriptor <: NSObject

Expand Down
12 changes: 6 additions & 6 deletions lib/mps/decomposition.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@cenum MPSMatrixDecompositionStatus::Cint begin
MPSMatrixDecompositionStatusSuccess = 0
MPSMatrixDecompositionStatusFailure = -1
MPSMatrixDecompositionStatusSingular = -2
MPSMatrixDecompositionStatusNonPositiveDefinite = -3
end
# @cenum MPSMatrixDecompositionStatus::Cint begin
# MPSMatrixDecompositionStatusSuccess = 0
# MPSMatrixDecompositionStatusFailure = -1
# MPSMatrixDecompositionStatusSingular = -2
# MPSMatrixDecompositionStatusNonPositiveDefinite = -3
# end


## lu
Expand Down
14 changes: 7 additions & 7 deletions lib/mps/images.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
## kernels

@cenum MPSImageEdgeMode::NSUInteger begin
MPSImageEdgeModeZero = 0
MPSImageEdgeModeClamp = 1
MPSImageEdgeModeMirror = 2
MPSImageEdgeModeMirrorWithEdge = 3
MPSImageEdgeModeConstant = 4
end
# @cenum MPSImageEdgeMode::NSUInteger begin
# MPSImageEdgeModeZero = 0
# MPSImageEdgeModeClamp = 1
# MPSImageEdgeModeMirror = 2
# MPSImageEdgeModeMirrorWithEdge = 3
# MPSImageEdgeModeConstant = 4
# end

@objcwrapper immutable=false MPSUnaryImageKernel <: MPSKernel

Expand Down
16 changes: 8 additions & 8 deletions lib/mps/kernel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# kernels
#

@cenum MPSKernelOptions::NSUInteger begin
MPSKernelOptionsNone = 0
MPSKernelOptionsSkipAPIValidation = 1 << 0
MPSKernelOptionsAllowReducedPrecision = 1 << 1
MPSKernelOptionsDisableInternalTiling = 1 << 2
MPSKernelOptionsInsertDebugGroups = 1 << 3
MPSKernelOptionsVerbose = 1 << 4
end
# @cenum MPSKernelOptions::NSUInteger begin
# MPSKernelOptionsNone = 0
# MPSKernelOptionsSkipAPIValidation = 1 << 0
# MPSKernelOptionsAllowReducedPrecision = 1 << 1
# MPSKernelOptionsDisableInternalTiling = 1 << 2
# MPSKernelOptionsInsertDebugGroups = 1 << 3
# MPSKernelOptionsVerbose = 1 << 4
# end


@objcwrapper MPSKernel <: NSObject
Expand Down
Loading

0 comments on commit 4b4ed49

Please sign in to comment.