Repository navigation
Conversation
…ompile` support (pytorch#186595)" This reverts commit f5471bd.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/189305
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 14 Cancelled Jobs, 2 Unrelated Failures, 1 Unclassified FailureAs of commit ba411ca with merge base 58b68c9 ( NEW FAILURE - The following job has failed:
UNCLASSIFIED FAILURE - DrCI could not classify the following job because the workflow did not run on the merge base. The failure may be pre-existing on trunk or introduced by this PR:
CANCELLED JOBS - The following jobs were cancelled. Please retry:
FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
|
|
The following ciflow label(s) have been added but CI has not been triggered yet because the workflows are awaiting approval:
Once a maintainer approves the workflows (scroll to the bottom of the PR page), the corresponding CI jobs will be triggered automatically. Please ping one of the reviewers if you do not have access to approve and run workflows. |
1 similar comment
|
The following ciflow label(s) have been added but CI has not been triggered yet because the workflows are awaiting approval:
Once a maintainer approves the workflows (scroll to the bottom of the PR page), the corresponding CI jobs will be triggered automatically. Please ping one of the reviewers if you do not have access to approve and run workflows. |
|
@pytorchbot label "release notes: cuda" |
|
@claude review these changes |
|
Claude finished @jansel's task in 3m 26s —— View job PR Review: #189305Summary: Reapplies #186595, replacing the Full review detailsCode Quality
Correctness (verified, no change needed)The whole approach hinges on
So no Testing
Backward CompatibilityOutput dtype/shape/ordering are preserved (row-major triu order, shape Recommendation: Approve. Correct, well-tested reapply. The only actionable items are the include ordering and a request to justify (or drop) the ROCm fp16 tolerance override. |
jansel
left a comment
There was a problem hiding this comment.
address automated feedback from claude
|
Thanks for the review. I addressed the feedback and changed the ROCm tolerance override to only apply to the backwards pass which is a bit more scoped. |
|
@pytorchbot merge |
|
This PR has pending changes requested. Please address the comments and update the PR before merging. |
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: 13 mandatory check(s) failed. The first few are:
Dig deeper by viewing the failures on hud |
|
@pytorchbot merge -i |
…pile` support (pytorch#186595)" (pytorch#189305) Reapplies pytorch#186595 after Meta internal revert. Let me know if there are any failures that require fixing from my end. /cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo @jansel @ngimel Pull Request resolved: pytorch#189305 Approved by: https://github.com/jansel, https://github.com/ngimel
…pile` support (pytorch#186595)" (pytorch#189305) Reapplies pytorch#186595 after Meta internal revert. Let me know if there are any failures that require fixing from my end. /cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo @jansel @ngimel Pull Request resolved: pytorch#189305 Approved by: https://github.com/jansel, https://github.com/ngimel
…pile` support (pytorch#186595)" (pytorch#189305) Reapplies pytorch#186595 after Meta internal revert. Let me know if there are any failures that require fixing from my end. /cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo @jansel @ngimel Pull Request resolved: pytorch#189305 Approved by: https://github.com/jansel, https://github.com/ngimel
…pile` support (pytorch#186595)" (pytorch#189305) Reapplies pytorch#186595 after Meta internal revert. Let me know if there are any failures that require fixing from my end. /cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo @jansel @ngimel Pull Request resolved: pytorch#189305 Approved by: https://github.com/jansel, https://github.com/ngimel
## Motivation #189102 bumped the gradient tolerances for `test_comprehensive_combinations_cuda_float16` after #186595 / #189305 reimplemented `torch.combinations` on top of `index_put`, whose fp16 backward Inductor accumulates in fp16. That PR only added the override to `inductor_override_kwargs["cuda"]`; `inductor_override_kwargs["xpu"]` is a separate dict and never got the equivalent entry, leaving XPU on the default fp16 gradient tolerance (`atol=1e-5, rtol=1e-3`), which is too tight for the fp16 accumulation rounding. Result: #195071 (`test_comprehensive_combinations_xpu_float16`) was disabled on 2026-08-27. ## Root cause on the failing sample Sample 17: `input=(4,) fp16, r=4, with_replacement=True` -> output `(35, 4)`. Each of the 4 inputs is copied into 35 output slots, so its gradient is the sum of 35 fp16 contributions. Forward is bit-identical between eager and Inductor; only the backward differs. Inductor lowers the `index_put(accumulate=True)` backward to a single fp16 atomic scatter (`triton_poi_fused_index_put_new_zeros_1`): ```python tmp6 = tl.load(in_ptr1 + (x0), xmask).to(tl.float32) tl.atomic_add(out_ptr0 + (tl.broadcast_to(tmp4, [XBLOCK])), tmp6, xmask, sem='relaxed') ``` `out_ptr0` is `*fp16`, so the 35 additions per slot round to fp16 on every step, in hardware-scheduling order. The XPU aten `index_put` accumulates in higher precision and rounds once: ``` # accumulate 100 x 0.0002 into an fp16 slot initialised to 1.0 (exact = 1.02) eager index_put_(accumulate=True) -> 1.01953125 inductor same op -> 1.0 (== naive fp16 read-add-write) ``` Against an fp64 reference on the failing sample: ``` grad(input): eager vs ref-fp64: max_rel = 3.65e-04 inductor vs ref-fp64: max_rel = 3.99e-03 inductor vs eager : max_rel = 1.6e-03 .. 4.9e-03 across runs (>> default rtol=1e-3) ``` The run-to-run spread comes from the nondeterministic atomic order: the same input produced 14 distinct fp16 results in 20 Inductor runs, vs 1 for eager. This is intrinsic fp16 accumulation rounding, not a correctness bug on either side, and matches the situation upstream addressed on CUDA in #189102. ## Fix Add the same `(combinations, f16)` override that #189102 added for CUDA to `inductor_override_kwargs["xpu"]`. Observed max abs diff is 1.22e-03 against an allowance of `2e-3 + 0.01 * 0.5 ~= 7e-3`, i.e. about 5.7x headroom. ## Test plan Nightly wheel `torch==2.15.0.dev20260830+xpu`, triton-xpu 3.8.0, on Intel Arc B390. Run from the pytorch checkout root: ``` PYTORCH_OPINFO_SAMPLE_INPUT_INDEX=17 TORCHINDUCTOR_FORCE_DISABLE_CACHES=1 \ python test/inductor/test_torchinductor_opinfo.py \ TestInductorOpInfoXPU.test_comprehensive_combinations_xpu_float16 ``` ``` # before: FAILED Tensor-likes are not close! 1/4 mismatched, # rel 1.066e-03 > 1e-03 allowed # after: OK ``` All samples, three consecutive runs: ``` TORCHINDUCTOR_FORCE_DISABLE_CACHES=1 \ python test/inductor/test_torchinductor_opinfo.py \ TestInductorOpInfoXPU.test_comprehensive_combinations_xpu_float16 ``` ``` # OK / OK / OK ``` All dtypes, cpu and xpu: ``` TORCHINDUCTOR_FORCE_DISABLE_CACHES=1 \ python test/inductor/test_torchinductor_opinfo.py \ -k test_comprehensive_combinations -v ``` ``` # Ran 14 tests OK (skipped=2) ``` Fixes #195071 _Note: authored with AI assistance._ Pull Request resolved: #195403 Approved by: https://github.com/etaf, https://github.com/jansel
…195403) ## Motivation pytorch#189102 bumped the gradient tolerances for `test_comprehensive_combinations_cuda_float16` after pytorch#186595 / pytorch#189305 reimplemented `torch.combinations` on top of `index_put`, whose fp16 backward Inductor accumulates in fp16. That PR only added the override to `inductor_override_kwargs["cuda"]`; `inductor_override_kwargs["xpu"]` is a separate dict and never got the equivalent entry, leaving XPU on the default fp16 gradient tolerance (`atol=1e-5, rtol=1e-3`), which is too tight for the fp16 accumulation rounding. Result: pytorch#195071 (`test_comprehensive_combinations_xpu_float16`) was disabled on 2026-08-27. ## Root cause on the failing sample Sample 17: `input=(4,) fp16, r=4, with_replacement=True` -> output `(35, 4)`. Each of the 4 inputs is copied into 35 output slots, so its gradient is the sum of 35 fp16 contributions. Forward is bit-identical between eager and Inductor; only the backward differs. Inductor lowers the `index_put(accumulate=True)` backward to a single fp16 atomic scatter (`triton_poi_fused_index_put_new_zeros_1`): ```python tmp6 = tl.load(in_ptr1 + (x0), xmask).to(tl.float32) tl.atomic_add(out_ptr0 + (tl.broadcast_to(tmp4, [XBLOCK])), tmp6, xmask, sem='relaxed') ``` `out_ptr0` is `*fp16`, so the 35 additions per slot round to fp16 on every step, in hardware-scheduling order. The XPU aten `index_put` accumulates in higher precision and rounds once: ``` # accumulate 100 x 0.0002 into an fp16 slot initialised to 1.0 (exact = 1.02) eager index_put_(accumulate=True) -> 1.01953125 inductor same op -> 1.0 (== naive fp16 read-add-write) ``` Against an fp64 reference on the failing sample: ``` grad(input): eager vs ref-fp64: max_rel = 3.65e-04 inductor vs ref-fp64: max_rel = 3.99e-03 inductor vs eager : max_rel = 1.6e-03 .. 4.9e-03 across runs (>> default rtol=1e-3) ``` The run-to-run spread comes from the nondeterministic atomic order: the same input produced 14 distinct fp16 results in 20 Inductor runs, vs 1 for eager. This is intrinsic fp16 accumulation rounding, not a correctness bug on either side, and matches the situation upstream addressed on CUDA in pytorch#189102. ## Fix Add the same `(combinations, f16)` override that pytorch#189102 added for CUDA to `inductor_override_kwargs["xpu"]`. Observed max abs diff is 1.22e-03 against an allowance of `2e-3 + 0.01 * 0.5 ~= 7e-3`, i.e. about 5.7x headroom. ## Test plan Nightly wheel `torch==2.15.0.dev20260830+xpu`, triton-xpu 3.8.0, on Intel Arc B390. Run from the pytorch checkout root: ``` PYTORCH_OPINFO_SAMPLE_INPUT_INDEX=17 TORCHINDUCTOR_FORCE_DISABLE_CACHES=1 \ python test/inductor/test_torchinductor_opinfo.py \ TestInductorOpInfoXPU.test_comprehensive_combinations_xpu_float16 ``` ``` # before: FAILED Tensor-likes are not close! 1/4 mismatched, # rel 1.066e-03 > 1e-03 allowed # after: OK ``` All samples, three consecutive runs: ``` TORCHINDUCTOR_FORCE_DISABLE_CACHES=1 \ python test/inductor/test_torchinductor_opinfo.py \ TestInductorOpInfoXPU.test_comprehensive_combinations_xpu_float16 ``` ``` # OK / OK / OK ``` All dtypes, cpu and xpu: ``` TORCHINDUCTOR_FORCE_DISABLE_CACHES=1 \ python test/inductor/test_torchinductor_opinfo.py \ -k test_comprehensive_combinations -v ``` ``` # Ran 14 tests OK (skipped=2) ``` Fixes pytorch#195071 _Note: authored with AI assistance._ Pull Request resolved: pytorch#195403 Approved by: https://github.com/etaf, https://github.com/jansel
…195403) ## Motivation pytorch#189102 bumped the gradient tolerances for `test_comprehensive_combinations_cuda_float16` after pytorch#186595 / pytorch#189305 reimplemented `torch.combinations` on top of `index_put`, whose fp16 backward Inductor accumulates in fp16. That PR only added the override to `inductor_override_kwargs["cuda"]`; `inductor_override_kwargs["xpu"]` is a separate dict and never got the equivalent entry, leaving XPU on the default fp16 gradient tolerance (`atol=1e-5, rtol=1e-3`), which is too tight for the fp16 accumulation rounding. Result: pytorch#195071 (`test_comprehensive_combinations_xpu_float16`) was disabled on 2026-08-27. ## Root cause on the failing sample Sample 17: `input=(4,) fp16, r=4, with_replacement=True` -> output `(35, 4)`. Each of the 4 inputs is copied into 35 output slots, so its gradient is the sum of 35 fp16 contributions. Forward is bit-identical between eager and Inductor; only the backward differs. Inductor lowers the `index_put(accumulate=True)` backward to a single fp16 atomic scatter (`triton_poi_fused_index_put_new_zeros_1`): ```python tmp6 = tl.load(in_ptr1 + (x0), xmask).to(tl.float32) tl.atomic_add(out_ptr0 + (tl.broadcast_to(tmp4, [XBLOCK])), tmp6, xmask, sem='relaxed') ``` `out_ptr0` is `*fp16`, so the 35 additions per slot round to fp16 on every step, in hardware-scheduling order. The XPU aten `index_put` accumulates in higher precision and rounds once: ``` # accumulate 100 x 0.0002 into an fp16 slot initialised to 1.0 (exact = 1.02) eager index_put_(accumulate=True) -> 1.01953125 inductor same op -> 1.0 (== naive fp16 read-add-write) ``` Against an fp64 reference on the failing sample: ``` grad(input): eager vs ref-fp64: max_rel = 3.65e-04 inductor vs ref-fp64: max_rel = 3.99e-03 inductor vs eager : max_rel = 1.6e-03 .. 4.9e-03 across runs (>> default rtol=1e-3) ``` The run-to-run spread comes from the nondeterministic atomic order: the same input produced 14 distinct fp16 results in 20 Inductor runs, vs 1 for eager. This is intrinsic fp16 accumulation rounding, not a correctness bug on either side, and matches the situation upstream addressed on CUDA in pytorch#189102. ## Fix Add the same `(combinations, f16)` override that pytorch#189102 added for CUDA to `inductor_override_kwargs["xpu"]`. Observed max abs diff is 1.22e-03 against an allowance of `2e-3 + 0.01 * 0.5 ~= 7e-3`, i.e. about 5.7x headroom. ## Test plan Nightly wheel `torch==2.15.0.dev20260830+xpu`, triton-xpu 3.8.0, on Intel Arc B390. Run from the pytorch checkout root: ``` PYTORCH_OPINFO_SAMPLE_INPUT_INDEX=17 TORCHINDUCTOR_FORCE_DISABLE_CACHES=1 \ python test/inductor/test_torchinductor_opinfo.py \ TestInductorOpInfoXPU.test_comprehensive_combinations_xpu_float16 ``` ``` # before: FAILED Tensor-likes are not close! 1/4 mismatched, # rel 1.066e-03 > 1e-03 allowed # after: OK ``` All samples, three consecutive runs: ``` TORCHINDUCTOR_FORCE_DISABLE_CACHES=1 \ python test/inductor/test_torchinductor_opinfo.py \ TestInductorOpInfoXPU.test_comprehensive_combinations_xpu_float16 ``` ``` # OK / OK / OK ``` All dtypes, cpu and xpu: ``` TORCHINDUCTOR_FORCE_DISABLE_CACHES=1 \ python test/inductor/test_torchinductor_opinfo.py \ -k test_comprehensive_combinations -v ``` ``` # Ran 14 tests OK (skipped=2) ``` Fixes pytorch#195071 _Note: authored with AI assistance._ Pull Request resolved: pytorch#195403 Approved by: https://github.com/etaf, https://github.com/jansel
…stency (#202803) Fixes #202798 Fixes #188985 ## Agent details (if applicable) Written with Claude Code (AI assistant). I reviewed it and ran the commands on my M4 Pro (macOS 27.0.1). The backward of `combinations` is `IndexBackward0`, i.e. `index_put(accumulate=True)`, which sums the fp16 gradients of repeated elements in a different order on MPS than on CPU. Both are equally close to a float64 reference, but they can differ from each other by up to 4e-3 relative, more than the default fp16 tolerance (rtol=1e-3). See #202798 for the numbers. This started with #186595 (landed 2026-07-05 as 5b84db3, reverted, then relanded 2026-07-15 as #189305 / 41d3568), which is when #188985 was filed. That PR replaced `meshgrid` + `masked_select` + `stack` with `self.index(nonzero_static(mask))`. Before it, the gradient for each repeated element came from expand's backward, a `sum` reduction that accumulates in fp32 on both CPU and MPS and rounds to fp16 once, so the two backends agreed exactly. After it, the backward goes through `index_put_(accumulate=True)`, which rounds to fp16 after every add. CPU does this serially in a fixed order (`cpu/IndexKernel.cpp`), and MPS does it with compare-and-swap fp16 atomics in whatever order the threads land (`AtomicType<half>` in `c10/metal/atomic.h`). Over 2000 seeds of the failing sample (`n=2, r=4, with_replacement=True`), the old formulation gives identical CPU and MPS grads every time, while the current one fails rtol=1e-3 in 6.7% of seeds (worst relative difference 2.2e-3). The same change also made fp16/bf16 `combinations` grads somewhat less accurate on every backend, which is out of scope here. This adds `combinations` to `FP16_LOW_PRECISION_LIST`, which already has `_unsafe_masked_index_put_accumulate` (the same accumulating `index_put`) for the same reason. Making MPS follow CPU's order instead would need a slower kernel that is no more accurate: even the exact sum, rounded once to fp16, fails the default tolerance against CPU in 37% of random test runs. The new tolerance still catches real accumulation bugs: a simulated lost atomic add is caught in every test run. The forward is exact indexing, so the looser tolerance hides nothing there. Closing #188985 re-enables the test in CI. Test plan: ``` python test/test_mps.py -k combinations ``` `test_output_grad_match_combinations_mps_float16` fails on main and passes with this change. All 12 `combinations` tests pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Pull Request resolved: #202803 Approved by: https://github.com/malfet Co-authored-by: Claude Opus 5.5 <[email protected]>
…stency (pytorch#202803) Fixes pytorch#202798 Fixes pytorch#188985 ## Agent details (if applicable) Written with Claude Code (AI assistant). I reviewed it and ran the commands on my M4 Pro (macOS 27.0.1). The backward of `combinations` is `IndexBackward0`, i.e. `index_put(accumulate=True)`, which sums the fp16 gradients of repeated elements in a different order on MPS than on CPU. Both are equally close to a float64 reference, but they can differ from each other by up to 4e-3 relative, more than the default fp16 tolerance (rtol=1e-3). See pytorch#202798 for the numbers. This started with pytorch#186595 (landed 2026-07-05 as 5b84db3, reverted, then relanded 2026-07-15 as pytorch#189305 / 41d3568), which is when pytorch#188985 was filed. That PR replaced `meshgrid` + `masked_select` + `stack` with `self.index(nonzero_static(mask))`. Before it, the gradient for each repeated element came from expand's backward, a `sum` reduction that accumulates in fp32 on both CPU and MPS and rounds to fp16 once, so the two backends agreed exactly. After it, the backward goes through `index_put_(accumulate=True)`, which rounds to fp16 after every add. CPU does this serially in a fixed order (`cpu/IndexKernel.cpp`), and MPS does it with compare-and-swap fp16 atomics in whatever order the threads land (`AtomicType<half>` in `c10/metal/atomic.h`). Over 2000 seeds of the failing sample (`n=2, r=4, with_replacement=True`), the old formulation gives identical CPU and MPS grads every time, while the current one fails rtol=1e-3 in 6.7% of seeds (worst relative difference 2.2e-3). The same change also made fp16/bf16 `combinations` grads somewhat less accurate on every backend, which is out of scope here. This adds `combinations` to `FP16_LOW_PRECISION_LIST`, which already has `_unsafe_masked_index_put_accumulate` (the same accumulating `index_put`) for the same reason. Making MPS follow CPU's order instead would need a slower kernel that is no more accurate: even the exact sum, rounded once to fp16, fails the default tolerance against CPU in 37% of random test runs. The new tolerance still catches real accumulation bugs: a simulated lost atomic add is caught in every test run. The forward is exact indexing, so the looser tolerance hides nothing there. Closing pytorch#188985 re-enables the test in CI. Test plan: ``` python test/test_mps.py -k combinations ``` `test_output_grad_match_combinations_mps_float16` fails on main and passes with this change. All 12 `combinations` tests pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Pull Request resolved: pytorch#202803 Approved by: https://github.com/malfet Co-authored-by: Claude Opus 5.5 <[email protected]>
…stency (pytorch#202803) Fixes pytorch#202798 Fixes pytorch#188985 ## Agent details (if applicable) Written with Claude Code (AI assistant). I reviewed it and ran the commands on my M4 Pro (macOS 27.0.1). The backward of `combinations` is `IndexBackward0`, i.e. `index_put(accumulate=True)`, which sums the fp16 gradients of repeated elements in a different order on MPS than on CPU. Both are equally close to a float64 reference, but they can differ from each other by up to 4e-3 relative, more than the default fp16 tolerance (rtol=1e-3). See pytorch#202798 for the numbers. This started with pytorch#186595 (landed 2026-07-05 as 5b84db3, reverted, then relanded 2026-07-15 as pytorch#189305 / 41d3568), which is when pytorch#188985 was filed. That PR replaced `meshgrid` + `masked_select` + `stack` with `self.index(nonzero_static(mask))`. Before it, the gradient for each repeated element came from expand's backward, a `sum` reduction that accumulates in fp32 on both CPU and MPS and rounds to fp16 once, so the two backends agreed exactly. After it, the backward goes through `index_put_(accumulate=True)`, which rounds to fp16 after every add. CPU does this serially in a fixed order (`cpu/IndexKernel.cpp`), and MPS does it with compare-and-swap fp16 atomics in whatever order the threads land (`AtomicType<half>` in `c10/metal/atomic.h`). Over 2000 seeds of the failing sample (`n=2, r=4, with_replacement=True`), the old formulation gives identical CPU and MPS grads every time, while the current one fails rtol=1e-3 in 6.7% of seeds (worst relative difference 2.2e-3). The same change also made fp16/bf16 `combinations` grads somewhat less accurate on every backend, which is out of scope here. This adds `combinations` to `FP16_LOW_PRECISION_LIST`, which already has `_unsafe_masked_index_put_accumulate` (the same accumulating `index_put`) for the same reason. Making MPS follow CPU's order instead would need a slower kernel that is no more accurate: even the exact sum, rounded once to fp16, fails the default tolerance against CPU in 37% of random test runs. The new tolerance still catches real accumulation bugs: a simulated lost atomic add is caught in every test run. The forward is exact indexing, so the looser tolerance hides nothing there. Closing pytorch#188985 re-enables the test in CI. Test plan: ``` python test/test_mps.py -k combinations ``` `test_output_grad_match_combinations_mps_float16` fails on main and passes with this change. All 12 `combinations` tests pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Pull Request resolved: pytorch#202803 Approved by: https://github.com/malfet Co-authored-by: Claude Opus 5.5 <[email protected]>
Reapplies #186595 after Meta internal revert. Let me know if there are any failures that require fixing from my end.
/cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo @jansel @ngimel