Sitelet https://github.com/gpuweb/gpuweb/pull/2773
Skip to content

Clarify conversions: floating, and out-of-range AbstractInt - #2773

Merged
kdashg merged 2 commits into
gpuweb:mainfrom
dneto0:issue-2769
May 13, 2022
Merged

kdashg merged 2 commits into
gpuweb:mainfrom
dneto0:issue-2769

Conversation

@dneto0

@dneto0 dneto0 commented Apr 19, 2022

Copy link
Copy Markdown
Contributor

Conversion Rank table:

  • Last column is now "Description", not "Notes". So it's more clearly normative.
  • AbstractInt to scalar integral conversions says it's identity when value is in
    range of the target type, and shader-creation error otherwise.
  • Reference floating point conversion section where needed.

Floating point conversion

  • Rewrite the "out of taget range" clauses as a procedure.
    This allows us to cleanly handle:
    • optional truncation of mantissa bits
    • the case where the source type is integral. This can occur now
      with i32 or u32 as source type and f16 as target type (whose max
      normal value is 65504).

Fixes: #2769

Conversion Rank table:
* Last column is now "Description", not "Notes". So it's more clearly normative.
* AbstractInt to scalar integral conversions says it's identity when value is in
  range of the target type, and shader-creation error otherwise.
* Reference floating point conversion section where needed.

Floating point conversion
* Rewrite the "out of taget range" clauses as a procedure.
  This allows us to cleanly handle:
    - optional truncation of mantissa bits
    - the case where the source type is integral. This can occur now
      with i32 or u32 as source type and f16 as target type (whose max
      normal value is 65504).

Fixes: gpuweb#2769
@dneto0 dneto0 added the wgsl WebGPU Shading Language Issues label Apr 19, 2022
@dneto0 dneto0 added this to the V1.0 milestone Apr 19, 2022
@github-actions

Copy link
Copy Markdown
Contributor

Previews, as seen when this build job started (6f70382):
WebGPU | IDL
WGSL
Explainer

@kdashg kdashg self-assigned this Apr 26, 2022
@kdashg

kdashg commented Apr 26, 2022

Copy link
Copy Markdown
Contributor
WGSL meeting minutes 2022-04-26
  • KG: PR from DN. Needs review.** I’ll try to review **…

@dneto0

dneto0 commented May 6, 2022

Copy link
Copy Markdown
Contributor Author

Ping @kdashg :-)

We don't want one of the adjacent value to be an infinity.
For example, twice the max finite value of the destination type should
be converted to the infinity of the destination type.
@kdashg

kdashg commented May 11, 2022

Copy link
Copy Markdown
Contributor
WGSL meeting minutes 2022-05-10
  • Waiting on KG review. (others?)
  • KG: Was supposed to review this … slight concerns when going over, will get back on this. In regards to feels like algorithm doesnt’ feel like returns a value in the normal case. Say set x to original value and x is fp with more size then ??? then can truncate and if x on the extreme is result otherwise it’s infinity with same type of x. If strict on algorithm either get max/min or infinity. Never return x normally.
  • DN: I think that’s in previous case, lets take offline. Added 1 word today, the previous clause if between 2 values then must be 1 of two. But meant 1 of 2 finite values.

@kdashg kdashg added the wgsl resolved Resolved - waiting for a change to the WGSL specification label May 11, 2022
@kdashg
kdashg merged commit 77c5550 into gpuweb:main May 13, 2022
github-actions Bot added a commit that referenced this pull request May 13, 2022
SHA: 77c5550
Reason: push, by @kdashg

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
github-actions Bot added a commit that referenced this pull request May 13, 2022
SHA: 77c5550
Reason: push, by @kdashg

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
github-actions Bot added a commit that referenced this pull request May 13, 2022
SHA: 77c5550
Reason: push, by @kdashg

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
jdarpinian pushed a commit to jdarpinian/gpuweb that referenced this pull request Aug 12, 2022
)

* Clarify conversions: floating, and out-of-range AbstractInt

Conversion Rank table:
* Last column is now "Description", not "Notes". So it's more clearly normative.
* AbstractInt to scalar integral conversions says it's identity when value is in
  range of the target type, and shader-creation error otherwise.
* Reference floating point conversion section where needed.

Floating point conversion
* Rewrite the "out of taget range" clauses as a procedure.
  This allows us to cleanly handle:
    - optional truncation of mantissa bits
    - the case where the source type is integral. This can occur now
      with i32 or u32 as source type and f16 as target type (whose max
      normal value is 65504).

Fixes: gpuweb#2769

* The adjacent-value rule only applies when both are finite

We don't want one of the adjacent value to be an infinity.
For example, twice the max finite value of the destination type should
be converted to the infinity of the destination type.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wgsl resolved Resolved - waiting for a change to the WGSL specification wgsl WebGPU Shading Language Issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Number literal conversion clarification

2 participants