Skip to content

fix(ptodsl): support runtime float integer casts - #1191

Open
Zhendong404 wants to merge 1 commit into
hw-native-sys:mainfrom
Zhendong404:codex/issue-1179-scalar-cast
Open

fix(ptodsl): support runtime float integer casts#1191
Zhendong404 wants to merge 1 commit into
hw-native-sys:mainfrom
Zhendong404:codex/issue-1179-scalar-cast

Conversation

@Zhendong404

@Zhendong404 Zhendong404 commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add runtime scalar float-to-integer casts through arith.fptosi and arith.fptoui.
  • Add runtime scalar integer-to-float casts through arith.sitofp and arith.uitofp.
  • Confirm and cover scalar.cast in ordinary scalar logic, outside SIMT execution.
  • Reject float builtin vector to integer casts with a clear TypeError instead of constructing invalid MLIR.
  • Support explicit index -> float conversion through arith.index_castui and arith.uitofp.
  • Document truncation-toward-zero and the undefined/poison behavior for out-of-range, NaN, and infinity float-to-integer inputs.
  • Add coverage for float literals, index-to-float, f16/bf16 and i8/i16/i64 widths, and fractional ST inputs.

Validation

  • ninja -C builds/issue-1179-scalar-cast check-dsl — 33/33 PTODSL tests passed.
  • scripts/sim_dsl.sh test/dsl-st/scalar_cast.py — all 9 ST cases passed on simulator, including fractional inputs that verify truncation toward zero.
  • python ptodsl/tests/test_scalar_cast.py — passed.

Closes #1179

@Zhendong404
Zhendong404 marked this pull request as ready for review August 8, 2026 03:56
@Zhendong404
Zhendong404 force-pushed the codex/issue-1179-scalar-cast branch 5 times, most recently from 8a9b656 to 6a44c09 Compare August 13, 2026 11:35
@Zhendong404
Zhendong404 force-pushed the codex/issue-1179-scalar-cast branch from 6a44c09 to 40a4da4 Compare August 17, 2026 09:10
@Zhendong404

Copy link
Copy Markdown
Collaborator Author

Should be covered by #1189

@Zhendong404 Zhendong404 reopened this Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] [PTODSL] [阻塞] scalar.cast 缺少 runtime float <-> integer 数值转换支持

1 participant