llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[Matrix] Implement matrix support for the `abs` HLSL Function

Open kmpeng opened this issue 9 months ago • 3 comments

Matrix requirements:

  • [ ] https://github.com/llvm/wg-hlsl/issues/387

HLSL:

Returns the absolute value of the specified value.

Parameters

Item Description
x
[in] The specified value.

Return Value

The absolute value of the x parameter.

Type Description

Name Template Type Component Type Size
x scalar, vector, or matrix float, int any
ret same as input x same as input x same dimension(s) as input x

Minimum Shader Model

This function is supported in the following shader models.

Shader Model Supported
Shader Model 2 (DirectX HLSL) and higher shader models yes
Shader Model 1 (DirectX HLSL) vs_1_1 and ps_1_4

See also

Intrinsic Functions (DirectX HLSL)

kmpeng avatar Mar 04 '26 00:03 kmpeng

Im interested in working on this issue.

Could someone suggest a good reference patch or completed matrix intrinsic implementation to follow? I'd like to understand the typical changes needed across the frontend, Sema, codegen, and tests before getting started.

Also, if there are any specific code paths related to matrix intrinsic support that I should look at first, I'd appreciate the guidance.

AjaySingh8923 avatar May 31 '26 13:05 AjaySingh8923

@AjaySingh8923 There are a few completed matrix issues listed under here that would be good references to follow!

kmpeng avatar Jun 02 '26 20:06 kmpeng

@llvm/issue-subscribers-clang-codegen

Author: Kaitlin Peng (kmpeng)

Matrix requirements: - [ ] https://github.com/llvm/wg-hlsl/issues/387

HLSL:

Returns the absolute value of the specified value.

Parameters

Item Description
<span id="x"></span><span id="X"></span>x<br/> [in] The specified value.<br/>

Return Value

The absolute value of the x parameter.

Type Description

Name Template Type Component Type Size
x scalar, vector, or matrix float, int any
ret same as input x same as input x same dimension(s) as input x

Minimum Shader Model

This function is supported in the following shader models.

Shader Model Supported
Shader Model 2 (DirectX HLSL) and higher shader models yes
Shader Model 1 (DirectX HLSL) vs_1_1 and ps_1_4

See also

<dl> <dt>

Intrinsic Functions (DirectX HLSL) </dt> </dl>