ByteDance-Seed / ByteDance-Seed/Triton-distributed

gen_amd_libdevice_extra.py --out cannot accept a file path

Open Beginner friendly
#186 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.5k
Forks
172
PR merge metrics
No merged PRs in 30d

Description

### Description

`python/triton_dist/tools/gen_amd_libdevice_extra.py --help` describes `--out` as a file path, but the option is configured with `action="store_true"`.

### Reproduction

At main commit `8260bc34398c2b8f36dc840fd22f741ca9294584`:

```console
$ python python/triton_dist/tools/gen_amd_libdevice_extra.py --out /tmp/libdevice-extra.ll
gen_amd_libdevice_extra.py: error: unrecognized arguments: /tmp/libdevice-extra.ll
```

Passing the bare flag also fails because `open(True)` treats the boolean as file descriptor 1:

```console
$ python python/triton_dist/tools/gen_amd_libdevice_extra.py --out
RuntimeWarning: bool is used as a file descriptor
io.UnsupportedOperation: not writable
```

Omitting `--out` still prints the generated LLVM IR to standard output.

### Expected behavior

`--out PATH` should write the generated LLVM IR to `PATH`, matching the command's help text, while omitting the option should continue writing to standard output.

Contributor guide

Open the contributing guide

Research direction

Start with python/triton_dist/tools/gen_amd_libdevice_extra.py and compare the --help description with how the --out argument is parsed and opened. Run the reported command with a temporary PATH and without --out; done means the path receives the generated LLVM IR while the omitted option still writes it to standard output.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.