|
aea88562
|
2023-05-19T16:52:43
|
|
Reland "Metal: Optimized BufferSubData per device"
This reverts commit ee64836f702332adaca58d9f452063a04b2da955 ,
relanding the patch stack described there.
Between patchsets 1 and 5:
- The shadow buffer allocation has been replaced with a multimap of
precisely-sized buffers, rather than rounding up buffer sizes.
- Garbage collection of shadow buffers is triggered in three situations:
- A certain number of context switches have occurred; this number
was hand-tuned to avoid GC every frame.
- A certain number of command buffer submissions has occurred; this
number was hand-tuned to GC no more often than every few seconds
on representative workloads.
- The total size of the allocated shadow buffers is more than 1 MB,
and either more than twice the size at the last garbage
collection, or 64 MB more than at the last garbage collection. In
this case, aggressive GC is performed in order to reclaim shadow
buffers more quickly.
Performance before and after these changes appears identical on
microbenchmarks. On one Figma test case, comparing GPU memory
allocated inside the BufferManager, peak consumption is decreased by
over 75%, and steady-state consumption decreases by over 88%.
Patchset 6 adds a needed workaround for a bug in the
AMDMTLBronzeDriver affecting uploads of client-side data, and
therefore some dEQP tests. It also streamlines the aggressive GC.
Bug: angleproject:7544
Change-Id: I81b061f0b33c27fa403527fa12d626f4e9c88ebe
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4497413
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
|
|
ee64836f
|
2023-02-11T17:56:06
|
|
Revert "Metal: Optimized BufferSubData per device"
This reverts commit 968041b54770af8917001d8fe9b52a881cfed0b2.
Includes the following patches:
git revert -n 995db1f66bcf87fc9e47d908fb2a885e810d2567 \
9a6c90c8f802b4d107a081bfccaf4be007e7af54 \
dbd47e378582ef86db52c7379cd220cf0b2c8193 \
369b320f92f54774879e8b8faff834fc8db0793e \
4abae6f97586448712e2dc1cced4a678b0901d7b \
968041b54770af8917001d8fe9b52a881cfed0b2
Several conflicts with top-of-tree were resolved during this revert.
The aim is to reland this with additional code which will reduce the
amount of excess buffer memory allocated, and release the resources
associated with temporary buffer allocations.
Bug: angleproject:7544
Change-Id: Ib7a6bc2ab1c2f23cb43112cd980106e2898c3826
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4240556
Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com>
Reviewed-by: Gregg Tavares <gman@chromium.org>
Commit-Queue: Kenneth Russell <kbr@chromium.org>
|
|
92f26ce3
|
2023-02-02T17:53:48
|
|
Metal: fix UBO argument buffers didn't work with managed storage.
This bug would happen when forceBufferGPUStorage feature is turned on.
This feature forces all buffers to use managed storage mode.
We use mtl::BufferPool to allocate an UBO argument buffer. However, we
didn't tell it to map the buffer. Later when we used MTLArgumentEncoder
to encode the buffer, mtl::Buffer::flush would be a no-op because the
Buffer didn't know that it was modified by the MTLArgumentEncoder on the
CPU. Consequently, its memory's encoding write wouldn't be visible to
the GPU.
Fix by passing a mapped pointer to mtl::BufferPool::allocate. This will
force a buffer mapping to occur. And memory flushing will properly be
invoked after MTLArgumentEncoder finishes the encoding.
Fixed: angleproject:7999
Change-Id: Ie486ae526672c89548ee14bc0824da1fdd5673c0
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4217055
Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Gregg Tavares <gman@chromium.org>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
|
|
9a6c90c8
|
2023-01-26T14:26:49
|
|
Reland "Metal: Avoid leaking buffers for GPU access for non-discrete"
The code would pass BufferManager::getBuffer(..,useShared=false,..)
and use that as key to try to obtain a buffer from the cache.
The BufferManager would store the returned buffers based on
the actual storage mode of the buffer. The storage mode for the
buffers for integrated / iOS devices is always shared.
The above logic would lead the buffer manager always storing returned
buffers to the cache, but never being able to consume any from the
cache. The cache is designed to grow unbounded, and so it did.
Remove the inconsistent logic of passing variation of "use shared bool"
as the arguments. Various places consulted various different Feature
options in inconsistent manner.
Instead, add Buffer::Usage for the callers to express what
kind of access pattern to expect a buffer to be used. Add explicit
MTLStorageMode parameters to Buffer constructing functions.
Remove redundant functions from Buffer.
Remove dead code from BufferPool related to allocation policy.
Reland: continue to allocate buffers with shared rather than managed
mode in BufferPool, as otherwise bug angleproject:7997 is encountered.
Bug: angleproject:7975
Change-Id: Iae4e75a85e6d49b20e724ed037a7c14cc0f7693f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4217712
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com>
Reviewed-by: Gregg Tavares <gman@chromium.org>
Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com>
Commit-Queue: Kenneth Russell <kbr@chromium.org>
|
|
dbd47e37
|
2023-01-30T20:54:24
|
|
Revert "Metal: Avoid leaking buffers for GPU access for non-discrete"
This reverts commit 369b320f92f54774879e8b8faff834fc8db0793e.
Reason for revert: WebGL 2.0 conformance tests failing on Mac/AMD per https://bugs.chromium.org/p/angleproject/issues/detail?id=7975#c4
Original change's description:
> Metal: Avoid leaking buffers for GPU access for non-discrete
>
> The code would pass BufferManager::getBuffer(..,useShared=false,..)
> and use that as key to try to obtain a buffer from the cache.
> The BufferManager would store the returned buffers based on
> the actual storage mode of the buffer. The storage mode for the
> buffers for integrated / iOS devices is always shared.
>
> The above logic would lead the buffer manager always storing returned
> buffers to the cache, but never being able to consume any from the
> cache. The cache is designed to grow unbounded, and so it did.
>
> Remove the inconsistent logic of passing variation of "use shared bool"
> as the arguments. Various places consulted various different Feature
> options in inconsistent manner.
>
> Instead, add Buffer::AccessPattern for the callers to express what
> kind of access pattern to expect a buffer to be used. Add explicit
> MTLStorageMode parameters to Buffer constructing functions.
> Remove redundant functions from Buffer.
> Remove dead code from BufferPool related to allocation policy.
>
> Bug: angleproject:7975
> Change-Id: I0c4661c55e8c907b702160ae42690269c049f6db
> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4194172
> Reviewed-by: Kenneth Russell <kbr@chromium.org>
> Commit-Queue: Kenneth Russell <kbr@chromium.org>
> Reviewed-by: Gregg Tavares <gman@chromium.org>
> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com>
Bug: angleproject:7975
Change-Id: I094de8e5b06392fe36a9887d6a817023baa48735
No-Presubmit: true
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4206187
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
|
|
369b320f
|
2023-01-26T14:26:49
|
|
Metal: Avoid leaking buffers for GPU access for non-discrete
The code would pass BufferManager::getBuffer(..,useShared=false,..)
and use that as key to try to obtain a buffer from the cache.
The BufferManager would store the returned buffers based on
the actual storage mode of the buffer. The storage mode for the
buffers for integrated / iOS devices is always shared.
The above logic would lead the buffer manager always storing returned
buffers to the cache, but never being able to consume any from the
cache. The cache is designed to grow unbounded, and so it did.
Remove the inconsistent logic of passing variation of "use shared bool"
as the arguments. Various places consulted various different Feature
options in inconsistent manner.
Instead, add Buffer::AccessPattern for the callers to express what
kind of access pattern to expect a buffer to be used. Add explicit
MTLStorageMode parameters to Buffer constructing functions.
Remove redundant functions from Buffer.
Remove dead code from BufferPool related to allocation policy.
Bug: angleproject:7975
Change-Id: I0c4661c55e8c907b702160ae42690269c049f6db
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4194172
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Commit-Queue: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Gregg Tavares <gman@chromium.org>
Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com>
|
|
d33a2222
|
2021-04-26T16:56:15
|
|
Upstream Apple's direct-to-Metal backend: compile libANGLE.
This change is meant to merge the metal backend changes from Apple's
direct-to-Metal backend. Taken from Kyle Piddington's CL:
https://chromium-review.googlesource.com/c/angle/angle/+/2857366/
The goal of this CL is to merge the metal backend code in a state
that compiles, but not to switch the Metal backend over to using
the direct-to-metal backend yet.
Bug: angleproject:5505
Bug: angleproject:6127
Change-Id: If6783e06e0086b3a1dd25c6f53caca5cfc96cb86
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2950067
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
|
|
69da0b92
|
2020-09-13T20:00:19
|
|
Metal: Use shared memory for small dynamic buffers.
- If BufferMtl is static or large size, don't use shadow copy. Use one
MTLBuffer and map directly on it.
- If BufferMtl is dynamic and small size, use shadow copy and buffer
pool of 10 MTLBuffer (s). The MTLBuffer is allocated in shared memory
in this case (PCI-E memory for example). MTLBuffer in shared memory
region doesn't need to sync content between CPU and GPU.
- When copyBuffer, if BufferMtl is being used by GPU use blit command to
do the copy on GPU side.
- Also implemented GL_MAP_UNSYNCHRONIZED_BIT.
Bug: angleproject:2634
Change-Id: I7a5aab309d24c76106a7087358ee5883ee05d250
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2408592
Commit-Queue: Le Hoang Quyen <le.hoang.q@gmail.com>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
|
|
fe26bae4
|
2019-10-29T18:38:53
|
|
Metal backend implementation pt 2
This is without Metal specific shader translator implemented yet.
Bug: angleproject:2634
Change-Id: I95d589442251c9ba111bd05a2dc379a36739046c
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1855069
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
|