Load resources faster with Metal 3

RSS for tag

Discuss the WWDC22 Session Load resources faster with Metal 3

Posts under wwdc2022-10104 tag

3 Posts

Post

Replies

Boosts

Views

Activity

Metal 3 MTLIO Loading multiple textures w/single command buffer causes data corruption
Is there a limit to the number MTLIO load texture commands that can safely be executed in a single command buffer? When I tried loading each face (6) of a cube texture using a single command buffer, some of the faces will have bad data. Basically... let cmdBuf = ioCommandQueue.makeCommandBuffer() for slice in 0...5 { cmdBuf.load(cubeTexture, slice: slice, level: 0, size: size, sourceBytesPerRow:bytesPerRow, sourceBytesPerImage: bytesPerImage, destinationOrigin: destOrigin, sourceHandle: fileHandles[slice], sourceHandleOffset: 0) } cmdBuf.commit() cmdBuf.waitUntilCompleted() /* This passes, even though my texture is messed up...? */ assert(cmdBuf.status == .complete) // Also, no errors or warnings when XCode Diagnostics / Metal Validation is turned on. If I use multiple command buffers (one load texture command each), everything is fine... for slice in 0...5 { // IMPORTANT: Moved inside the LOOP let cmdBuf = ioCommandQueue.makeCommandBuffer() cmdBuf.load(cubeTexture, slice: slice, level: 0, size: size, sourceBytesPerRow:bytesPerRow, sourceBytesPerImage: bytesPerImage, destinationOrigin: destOrigin, sourceHandle: fileHandles[slice], sourceHandleOffset: 0) // IMPORTANT: Moved inside the LOOP cmdBuf.commit() cmdBuf.waitUntilCompleted() assert(cmdBuf.status == .complete) } I'm assuming this a bug (opened FB10582329)... Or at the very least, some documentation or Metal Validation log would be helpful to understanding what's going wrong/workaround. I've uploaded reduced reproduction (Single Swift file, command line application, XCode project) to this GitHub Repository: https://github.com/peterwmwong/x-mtlio-load-multiple-textures Thanks.
1
0
1.4k
Aug ’22
Metal 3 MTLIO Loading multiple textures w/single command buffer causes data corruption
Is there a limit to the number MTLIO load texture commands that can safely be executed in a single command buffer? When I tried loading each face (6) of a cube texture using a single command buffer, some of the faces will have bad data. Basically... let cmdBuf = ioCommandQueue.makeCommandBuffer() for slice in 0...5 { cmdBuf.load(cubeTexture, slice: slice, level: 0, size: size, sourceBytesPerRow:bytesPerRow, sourceBytesPerImage: bytesPerImage, destinationOrigin: destOrigin, sourceHandle: fileHandles[slice], sourceHandleOffset: 0) } cmdBuf.commit() cmdBuf.waitUntilCompleted() /* This passes, even though my texture is messed up...? */ assert(cmdBuf.status == .complete) // Also, no errors or warnings when XCode Diagnostics / Metal Validation is turned on. If I use multiple command buffers (one load texture command each), everything is fine... for slice in 0...5 { // IMPORTANT: Moved inside the LOOP let cmdBuf = ioCommandQueue.makeCommandBuffer() cmdBuf.load(cubeTexture, slice: slice, level: 0, size: size, sourceBytesPerRow:bytesPerRow, sourceBytesPerImage: bytesPerImage, destinationOrigin: destOrigin, sourceHandle: fileHandles[slice], sourceHandleOffset: 0) // IMPORTANT: Moved inside the LOOP cmdBuf.commit() cmdBuf.waitUntilCompleted() assert(cmdBuf.status == .complete) } I'm assuming this a bug (opened FB10582329)... Or at the very least, some documentation or Metal Validation log would be helpful to understanding what's going wrong/workaround. I've uploaded reduced reproduction (Single Swift file, command line application, XCode project) to this GitHub Repository: https://github.com/peterwmwong/x-mtlio-load-multiple-textures Thanks.
Replies
1
Boosts
0
Views
1.4k
Activity
Aug ’22
How does the performance of MTLIOCommandQueue compare to GCD?
I am implementing asset pipelines for a metal app and am deciding between the new Metal IO support and more traditional approaches like dispatch_io. Does the MTLCommandQueue use GCD as its backend, or how do the approaches compare?
Replies
0
Boosts
0
Views
923
Activity
Jul ’22
What about MTDAsset?
As we get MTLBuffer when loading a file(which can contain lighting, animation, materials), like typeless memory blob, how can we get a MTDMesh with sub meshes from the buffer? Thanks in advance!
Replies
0
Boosts
0
Views
552
Activity
Jun ’22