Repository navigation
Adding hal.device.memoize op. - #17938
Conversation
bbb7cbb to
cb7c794
Compare
50bdb46 to
2a9e223
Compare
cb7c794 to
7e1b6bb
Compare
2a9e223 to
608d477
Compare
7e1b6bb to
d9039cf
Compare
608d477 to
827bf40
Compare
d9039cf to
9a9bff8
Compare
827bf40 to
261150d
Compare
2eead66 to
1ecdcd5
Compare
c957a86 to
3383143
Compare
3383143 to
ddf26ba
Compare
1ecdcd5 to
b745b8f
Compare
b745b8f to
35ef89f
Compare
ddf26ba to
1cf9b44
Compare
| %result = hal.device.memoize<%device : !hal.device> affinity(%affinity) -> !hal.command_buffer { | ||
| // CHECK-NEXT: hal.command_buffer.create | ||
| %cmd = hal.command_buffer.create device(%device : !hal.device) | ||
| mode(OneShot) | ||
| categories("Transfer|Dispatch") : !hal.command_buffer | ||
| // CHECK-NEXT: hal.return | ||
| hal.return %cmd : !hal.command_buffer | ||
| } |
There was a problem hiding this comment.
Progress on #17875. Nothing is generating these yet.
Are you planning on creating these hal.device.memoize ops with regions explicitly or by having some pass go through and wrap the currently generated IR in those ops after some analysis (e.g. looking for create -> ... -> finalize op sequences)?
On that issue you say
Now conversion will (where profitable) nest the command buffer creation in a
hal.device.memoizeop
There was a problem hiding this comment.
Explicitly only to start - we could start to use them elsewhere now that they exist, though, such as by replacing the MemoizeDeviceQueries pass by just finding device queries and fusing them into memoize regions or creating memoize regions. MaterializeResourceCaches may also be able to use memoize regions instead of having its special per-device logic but changing to just identify the lookup pseudo ops and replacing them with memoize ops that do the loading in-place (though that would rely on the deduplication being improved in the outlining pass here).
1cf9b44 to
9d6cb08
Compare
957816b to
cbd13dc
Compare
9d6cb08 to
609933f
Compare
cbd13dc to
910ba67
Compare
363bcb6 to
cacae7d
Compare
9cd1a55 to
b359de0
Compare
910ba67 to
3dd77fc
Compare
8f2f8f5 to
f721fd0
Compare
3dd77fc to
2cef10f
Compare
This is an inline nested region that returns HAL resources for the given device and affinity pair. The region may only implicitly capture constants and global values in order for it to be outlined for initialization, though in the future we may extend this to support dynamic values by adding an LRU cache. To start all memoize regions are inlined after conversion until the op has a proper pass to perform the memoization. This will also serve as a useful debug feature for isolating memoization related issues. The initial outlining and proper memoization pass is present but disabled by default until we can verify all targets properly support reusable command buffers.
2cef10f to
5b997af
Compare
This is an inline nested region that returns HAL resources for the given device and affinity pair. The region may only implicitly capture constants and global values in order for it to be outlined for initialization, though in the future we may extend this to support dynamic values by adding an LRU cache.
To start all memoize regions are inlined after conversion. This optional inlining will also serve as a useful debug feature for isolating memoization related issues. The initial outlining and proper memoization pass is present but disabled by default until we can verify all targets properly support reusable command buffers.
Progress on #17875. Nothing is generating these yet.
Example:
->