Lightning-AI / Lightning-AI/lightning-thunder

dividing a float16 tensor by a python float is inaccurate with nvfuser

Open
#1,724 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

numerical accuracy nvfuser
Dominant language
Python
Stars
1.5k
Forks
121
PR merge metrics
No merged PRs in 30d

Description

The sample case of `test_core_vs_torch_consistency_div_nvfuser_cuda_thunder.dtypes.float16` which uses a python float as the denominator fails with numerical inaccuracy. If the same sample is run with a tensor with empty shape, the test passes. Specifically, if `.item()` is deleted from [this line](https://github.com/Lightning-AI/lightning-thunder/blob/880419df25024b52fe8674fd2ef305348a056a62/thunder/tests/opinfos.py#L74), the test passes.

cc @tfogal

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with thunder/tests/opinfos.py at line 74 and run test_core_vs_torch_consistency_div_nvfuser_cuda_thunder.dtypes.float16. Compare the failing float16 division with a Python-float denominator against the empty-shape case, then trace the relevant nvfuser consistency path. Done means the sample no longer reports numerical inaccuracy while retaining the existing test coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.