Repository navigation
Replies: 14 comments 10 replies
|
OK, my second attempt; hope this works better (at least the file is larger ;-): |
|
Thank you to everyone who ran the test. Here is what came back. In short: I had five testers (me, two here and two others on a Discord channel) and six Apple Silicon Macs tested, from an 8 GB M1 to a 36 GB M4 Max, under macOS 15, 26 and 27. All seventeen kernels that Apple's OpenCL used to refuse are now accepted, the whole pipeline runs on the graphics card on every machine with 16 GB or more, the GPU results match the processor's, and nothing crashed. What was testedEach machine exported the same photo five times with The photo is a 24-megapixel Sony raw, exported at 2048 px, with highlight reconstruction in "harmonic transposition" mode, profiled denoise, lens correction, two instances of diffuse or sharpen, and the contrast equalizer. The machines
The M1 is my own machine; the five others are testers'. For comparison, one tester first ran a nightly build of How to read the numbersThe figures below are written in scientific notation: 3.1e-12 is 3.1 × 10⁻¹², i.e. 0.0000000000031. The more negative the exponent, the smaller the difference. Some landmarks, all on the 0-to-1 scale Ansel uses for a pixel:
Two different kinds of numbers appear, and they do not measure the same thing. The built-in checks ("Do the GPU results match the processor's?") do not look at the photo. Ansel builds a small synthetic problem, solves it once on the graphics card and once on the processor, and reports the largest difference between the two answers. For the sparse solver that difference is relative (|GPU − CPU| / |CPU|, no unit): 3.1e-12 means the two agree to about eleven significant digits. For the three image stages it is an absolute difference between two 509 × 371 synthetic images whose values lie between 0 and 1: 2.4e-07 is the grain of the 32-bit float the pixels are stored in, so the two cannot agree any better. Nothing here depends on an output encoding: everything is compared as floating-point values, before any conversion to 8 or 16 bits. The export comparisons ("Are two identical exports identical?") compare two exports of the real photo, pixel by pixel. The exports are PFM files, 32-bit floating point without loss, so no 8- or 16-bit rounding hides a difference. "max |d| 2e-4" means the most different pixel differs by 0.0002 on the 0-to-1 scale, about a twentieth of an 8-bit step: measurable, not visible. The percentage next to it counts pixels that are not strictly identical, however small the difference; most of them differ by far less than the maximum. Do the GPU results match the processor's?Yes. The four built-in checks return the same figures on all six Macs, to the last digit:
For scale, one step of an 8-bit image is 3.9e-03, and one step of a 16-bit image is 1.5e-05. These differences are far below anything an export can show. The first line is the one that matters most. Apple's graphics cards cannot compute in double precision, so the branch has them emulate it with pairs of single-precision numbers. That line says the emulation agrees with true double precision to about ten significant digits. SpeedTime for the whole pipeline, same export, same machine:
"Processor time" is the total work done by all cores; it is what keeps the machine busy and the fans running. On machines with 16 GB or more, OpenCL makes the export 15 to 30 % faster and leaves the processor almost idle. On the 8 GB M1 it brings no speed, only a processor that is less than half as busy: there is not enough memory for the graphics card to take the whole pipeline. Highlight reconstruction itself takes about the same time on the graphics card as on the processor (0.9 to 1.6 s depending on the machine). The gain comes from the pipeline no longer moving back and forth between the two. MemoryThe second change in the branch concerns how much memory Ansel allows itself on the graphics card. On a Mac the graphics card has no memory of its own: it shares the machine's RAM. Apple's OpenCL describes that shared memory with two figures, and the testers' logs show a fixed relation between them:
The old rule set the whole budget at half the largest single allocation. That rule was tuned for Intel graphics, where the figure reflects a real limit of the driver. On a Mac it works out to 3/32 of the device memory, or about a sixteenth of the RAM, for no hardware reason. The branch drops that rule on Apple hardware. The budget is now the device memory minus a reserve left to the system (512 MB by default, adjustable in the preferences), and never more than the RAM that is actually free at that moment.
The new ceiling is an upper bound, not what Ansel gets: the free RAM decides. On my 8 GB M1 the budget actually available during the test was 1.2 to 2.1 GB, not 4.8. To put these figures in context, the heaviest modules of this export ask for 1.7 GB (highlight reconstruction), 2.2 GB (demosaicing) and 3.5 to 3.8 GB (profiled denoise), and the export used 3.9 GB of graphics memory at its peak. Under the old rule not even the 36 GB Mac could run profiled denoise on its graphics card. With the branch, every tester's machine ran the whole pipeline on the GPU. Ansel still refuses what does not fit: on the 8 GB M1, profiled denoise stays on the processor, correctly. Are two identical exports identical?On the five testers' machines, yes: of twenty OpenCL exports, each one is bit-for-bit identical to the others from the same machine. On the two machines that ran the test on two different days, the result was also identical from one day to the next. On my 8 GB M1, which is always short of memory, identical exports differ slightly from one run to the next (by a few millionths, invisible). That behaviour exists on Limits of this test
One unrelated observationThe Thanks again to the testers. |
|
Wow, thanks for the thorough analysis! This should improve Ansel's performance
on Apple Silicon Macs considerably, even if the interactive in the darkroom has not
been tested. At least, it can be better matched to Apple's specific architecture.
All the best, and keep up the good work!
…-- Jürgen
-- If I don't see you no more on this world
Juergen Koslowski I'll meet you on the next one
***@***.******@***.***)and don't be late!
Sent from Swiss-based encrypted [ProtonMail](https://protonmail.com), (Jimi Hendrix, Voodoo Child, SR)
Sent with [Proton Mail](https://proton.me/mail/home) secure email.
On Thursday, October 1st, 2026 at 9:44 AM, Miguel Moquillon ***@***.***> wrote:
Thank you to everyone who ran the test. Here is what came back.
In short: I had five testers (me, two here and two others on a Discord channel) and six Apple Silicon Macs tested, from an 8 GB M1 to a 36 GB M4 Max, under macOS 15, 26 and 27. All seventeen kernels that Apple's OpenCL used to refuse are now accepted, the whole pipeline runs on the graphics card on every machine with 16 GB or more, the GPU results match the processor's, and nothing crashed.
What was tested
Each machine exported the same photo five times with ansel-cli: three times with OpenCL, once without, and once with built-in checks that solve the same problems on the graphics card and on the processor and compare the two.
The photo is a 24-megapixel Sony raw, exported at 2048 px, with highlight reconstruction in "harmonic transposition" mode, profiled denoise, lens correction, two instances of diffuse or sharpen, and the contrast equalizer.
The machines
Machine RAM macOS Kernels refused Modules left on the processor Crashes
M1 8 GB 26.7 0 1 (profiled denoise) none
M2 Pro 16 GB 15.7 0 none none
M4 16 GB 15.7 0 none none
M3 Pro 18 GB 26.6 0 none none
M4 Pro 24 GB 27.0 0 none none
M4 Max 36 GB 27.0 0 none none
The M1 is my own machine; the five others are testers'.
For comparison, one tester first ran a nightly build of master by mistake, on the M4 Pro. That log shows the situation before the branch: seventeen kernels refused, and highlight reconstruction, demosaicing and profiled denoise sent back to the processor for lack of GPU memory budget.
Do the GPU results match the processor's?
Yes. The four built-in checks return the same figures on all six Macs, to the last digit:
Check Largest difference between GPU and processor
Sparse Cholesky solver 4.25e-10 (relative)
Dome stage 1.79e-07
Joint core stage 2.98e-07
Anisotropic stage 3.58e-07
For scale, one step of an 8-bit image is 3.9e-03, and one step of a 16-bit image is 1.5e-05. These differences are far below anything an export can show.
The first line is the one that matters most. Apple's graphics cards cannot compute in double precision, so the branch has them emulate it with pairs of single-precision numbers. That line says the emulation agrees with true double precision to about ten significant digits.
Speed
Time for the whole pipeline, same export, same machine:
Machine With OpenCL Processor only Processor time used with OpenCL Processor time used without OpenCL
M1, 8 GB 6.8 to 7.2 s 6.0 to 7.0 s 14.6 s 36 s
M2 Pro, 16 GB 2.4 s 3.4 s 0.8 s 25.8 s
M4, 16 GB 2.7 to 2.9 s 3.5 s 0.7 s 25.8 s
M3 Pro, 18 GB 2.3 to 2.8 s 3.2 s 0.8 s 25.7 s
M4 Pro, 24 GB 1.6 s 2.2 s 0.7 s 19.1 s
M4 Max, 36 GB 1.4 to 2.0 s 2.4 s 0.7 s 18.4 s
"Processor time" is the total work done by all cores; it is what keeps the machine busy and the fans running.
On machines with 16 GB or more, OpenCL makes the export 15 to 30 % faster and leaves the processor almost idle. On the 8 GB M1 it brings no speed, only a processor that is less than half as busy: there is not enough memory for the graphics card to take the whole pipeline.
Highlight reconstruction itself takes about the same time on the graphics card as on the processor (0.9 to 1.6 s depending on the machine). The gain comes from the pipeline no longer moving back and forth between the two.
Memory
The second change in the branch concerns how much memory Ansel allows itself on the graphics card.
On a Mac the graphics card has no memory of its own: it shares the machine's RAM. Apple's OpenCL describes that shared memory with two figures, and the testers' logs show a fixed relation between them:
- the device memory, which is 2/3 to 3/4 of the RAM depending on the macOS version;
- the largest single allocation, which is exactly 3/16 of the device memory on all six machines.
The old rule set the whole budget at half the largest single allocation. That rule was tuned for Intel graphics, where the figure reflects a real limit of the driver. On a Mac it works out to 3/32 of the device memory, or about a sixteenth of the RAM, for no hardware reason.
The branch drops that rule on Apple hardware. The budget is now the device memory minus a reserve left to the system (512 MB by default, adjustable in the preferences), and never more than the RAM that is actually free at that moment.
Machine RAM Device memory Largest single allocation (3/16) Old budget New ceiling
M1 8 GB 5.3 GB 1.0 GB 0.5 GB 4.8 GB
M2 Pro, M4 16 GB 10.7 GB 2.0 GB 1.0 GB 10.2 GB
M3 Pro 18 GB 13.3 GB 2.5 GB 1.25 GB 12.8 GB
M4 Pro 24 GB 17.8 GB 3.3 GB 1.7 GB 17.3 GB
M4 Max 36 GB 28.1 GB 5.3 GB 2.6 GB 27.6 GB
The new ceiling is an upper bound, not what Ansel gets: the free RAM decides. On my 8 GB M1 the budget actually available during the test was 1.2 to 2.1 GB, not 4.8.
To put these figures in context, the heaviest modules of this export ask for 1.7 GB (highlight reconstruction), 2.2 GB (demosaicing) and 3.5 to 3.8 GB (profiled denoise), and the export used 3.9 GB of graphics memory at its peak. Under the old rule not even the 36 GB Mac could run profiled denoise on its graphics card. With the branch, every tester's machine ran the whole pipeline on the GPU. Ansel still refuses what does not fit: on the 8 GB M1, profiled denoise stays on the processor, correctly.
Are two identical exports identical?
On the five testers' machines, yes, with one exception: of twenty OpenCL exports, nineteen are bit-for-bit identical to the others from the same machine. The exception is the first export on the 18 GB M3 Pro, where profiled denoise was briefly short of memory and was processed in tiles.
On my 8 GB M1, which is always short of memory, identical exports differ slightly from one run to the next (by a few millionths, invisible). That behaviour exists on master too and is not caused by the branch.
Limits of this test
- One photo, one export size. A full-resolution export or a very different edit may behave differently.
- Command-line exports only. The darkroom, where OpenCL matters most for interactive work, was not part of the test.
- Two of the five testers used an earlier build of the same branch; the code under test was the same.
- Every Mac here takes the emulated double-precision path. Graphics cards that have real double precision (most NVIDIA and AMD cards) take another path, which these tests do not cover. That is what the GNU/Linux call for testers is for.
One unrelated observation
The master nightly that was run by mistake on the M4 Pro (macOS 27) failed all four of its OpenCL exports, right after the diffuse or sharpen module, with no error message; its processor-only export succeeded. The branch build exports normally on the same machine. I do not know the cause and have not investigated; I mention it in case someone else has seen it.
Thanks again to the testers.
—
Reply to this email directly, [view it on GitHub](#1466?email_source=notifications&email_token=AH5TBJYM45QSEQ2KJCJM26L5RYDPVA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOBWHEZTSOBYUZZGKYLTN5XKO3LFNZ2GS33OUVSXMZLOOSWGM33PORSXEX3DNRUWG2Y#discussioncomment-18693988), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AH5TBJZVVSYKUBN4X2RN2MT5RYDPVAVCNFSNUABIKJSXA33TNF2G64TZHMYTCMZTG4ZTGNZSHNCGS43DOVZXG2LPNY5TCMBZGA3DOMJRUF3AE).
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for [iOS](https://github.com/notifications/mobile/ios/AH5TBJ7TQC3NYLFTRNT6KNT5RYDPVA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOBWHEZTSOBYUZZGKYLTN5XKO3LFNZ2GS33OUVSXMZLOOSVGM33PORSXEX3JN5ZQ) and [Android](https://github.com/notifications/mobile/android/AH5TBJ7N4RW5IKM6YAWHSCT5RYDPVA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOBWHEZTSOBYUZZGKYLTN5XKO3LFNZ2GS33OUVSXMZLOOSXGM33PORSXEX3BNZSHE33JMQ). Download it today!
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
|
this is fantastic work. |
|
My results for the latest test 2: |
|
Not sure if it is still helpful, but here are the results for my M5 Macbook air. Happy to redo if anything is incorrect. |
|
I did some changes after @Jiyone feedbacks. In order to ensure the Apple Silicon Macs are correctly detected, could you give me the result of the following command in a terminal: clinfo | grep -E "Platform Name|Device Name|Device Vendor"And in the case brew install clinfo |
|
Hello,
Here's the clinfo result:
Platform Name Apple
Platform Name Apple
Device Name Apple M4 Pro
Device Vendor Apple
Device Vendor ID 0x1027f00
Platform Name Apple
Device Name Apple M4 Pro
Platform Name Apple
Device Name Apple M4 Pro
Platform Name Apple Device Name Apple M4 Pro
Hope that helps!
…-- If I don't see you no more on this world
Juergen Koslowski I'll meet you on the next one
***@***.******@***.***)and don't be late!
Sent from Swiss-based encrypted [ProtonMail](https://protonmail.com), (Jimi Hendrix, Voodoo Child, SR)
Sent with [Proton Mail](https://proton.me/mail/home) secure email.
On Wednesday, October 28th, 2026 at 4:58 PM, Miguel Moquillon ***@***.***> wrote:
I did some changes after ***@***.***(https://github.com/Jiyone) feedbacks. In order to ensure the Apple Silicon Macs are correctly detected, could you give me the result of the following command in a terminal:
clinfo
|
grep -E
"
Platform Name|Device Name|Device Vendor
"
And in the case clinfo isn't installed:
brew install clinfo
—
Reply to this email directly, [view it on GitHub](#1466?email_source=notifications&email_token=AH5TBJZLZVAHPNUTQHORG3D5WIJSJA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOJSGQ3DMMRZUZZGKYLTN5XKO3LFNZ2GS33OUVSXMZLOOSWGM33PORSXEX3DNRUWG2Y#discussioncomment-19246629), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AH5TBJZRAYOB2JXBAIW3V5T5WIJSJAVCNFSNUABIKJSXA33TNF2G64TZHMYTCMZTG4ZTGNZSHNCGS43DOVZXG2LPNY5TCMBZGA3DOMJRUF3AE).
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for [iOS](https://github.com/notifications/mobile/ios/AH5TBJ4YGN26BWOKBOKAGZ35WIJSJA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOJSGQ3DMMRZUZZGKYLTN5XKO3LFNZ2GS33OUVSXMZLOOSVGM33PORSXEX3JN5ZQ) and [Android](https://github.com/notifications/mobile/android/AH5TBJ5ANVNS6UUCBJZEAFT5WIJSJA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOJSGQ3DMMRZUZZGKYLTN5XKO3LFNZ2GS33OUVSXMZLOOSXGM33PORSXEX3BNZSHE33JMQ). Download it today!
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
|
Platform Name Apple |
|
Platform Name Apple |
|
And mine: |


Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This discussion is related to the Some perfectible performance measures on different laptops one.
I have been working on making Ansel use the graphics card properly on Apple Silicon Macs, and I need a few people with Macs other than mine to check that it works. No technical knowledge is needed: the test is a file you double-click, and it takes about five minutes.
OpenCL on new Apple Silicon Macs (M-architecture)
Apple M-architecture computers don't support anymore OpenCL. Instead, a new low-level, low-overhead hardware-accelerated 3D graphic and compute shader API has been introduced with this architecture: Metal. Metal combines functions similar to OpenGL and OpenCL in one API. For applications built upon the OpenCL API, a shim is provided, whose role is to convert OpenCL kernels (aka OpenCL functions) for their execution on Metal.
The problem
Ansel can use the graphics card (through OpenCL) to speed up processing. On Apple Silicon Macs this worked poorly, for two reasons:
Apple's Metal (and hence OpenCL) doesn't support double-precision numbers: seventeen of the GPU functions (OpenCL kernels) used by the highlight reconstruction in the "harmonic transposition" mode were refused by the system at startup. You may have seen this line in a terminal:
So this mode always ran on the processor instead. The other modes of the module were not affected.
Ansel limited the memory it would use on the graphics card to 512 MB on every Mac, whether it had 8 GB or 64 GB of RAM. Most modules did not fit in that and also fell back to the processor. The limit came from a rule tuned for Intel graphics, which does not suit Apple hardware.
What has been done
On my own Mac (M1, 8 GB) all seventeen kernels are now accepted, and highlight reconstruction (harmonic transposition), demosaicing, lens correction and diffuse/sharpen run on the graphics card. But one small machine is not proof. I need to know how this behaves on Macs with more memory and newer chips.
Who I am looking for
What you would do
Ansel-b2a8fe86d7-arm64.dmg) and the test kit (testers-m-mac.zip):dmg. You can install Ansel in Applications, or simply leave thedmgopen: the test finds it either way.ansel-test-<date>.zipthat appears on your Desktop to a reply or comment on this discussion.A README in English and in French is included in the kit.
What the test does
It exports the same photo (provided in the kit) five times: three times with the graphics card, once without, and once with built-in checks that compare the graphics card's results against the processor's. For each export it records what Ansel printed, how long it took, and which modules ran on the graphics card.
A word of caution
This is a test build, not a release. If you install it over your usual Ansel, keep a copy of the version you normally use, and do not rely on it for important work. Running the test itself is safe either way, since it never opens your library.
Thank you in advance. Every report helps, including "it did not work": in that case a screenshot of the window is all I need.
All reactions