Skip to content

Commit 309e02f

Browse files
committed
Respond to comments
- Check that TensorDim < 3 using yaml returns: . - Rename some things and remove copypasta
1 parent dd15ce4 commit 309e02f

File tree

9 files changed

+104
-78
lines changed

9 files changed

+104
-78
lines changed

include/ur_api.h

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9624,7 +9624,7 @@ urEnqueueNativeCommandExp(
96249624
#if !defined(__GNUC__)
96259625
#pragma endregion
96269626
#endif
9627-
// Intel 'oneAPI' Unified Runtime Experimental API for enqueuing work through native APIs
9627+
// Intel 'oneAPI' Unified Runtime Experimental API for mapping tensor objects
96289628
#if !defined(__GNUC__)
96299629
#pragma region tensor map(experimental)
96309630
#endif
@@ -9745,6 +9745,8 @@ typedef enum ur_exp_tensor_map_oob_fill_flag_t {
97459745
/// + `NULL == PixelBoxUpperCorner`
97469746
/// + `NULL == ElementStrides`
97479747
/// + `NULL == hTensorMap`
9748+
/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT
9749+
/// + `TensorRank < 3`
97489750
UR_APIEXPORT ur_result_t UR_APICALL
97499751
urTensorMapEncodeIm2ColExp(
97509752
ur_device_handle_t hDevice, ///< [in] Handle of the device object.
@@ -9754,18 +9756,18 @@ urTensorMapEncodeIm2ColExp(
97549756
const uint64_t *GlobalDim, ///< [in] Array containing tensor size (number of elements) along each of
97559757
///< the TensorRank dimensions.
97569758
const uint64_t *GlobalStrides, ///< [in] Array containing stride size (in bytes) along each of the
9757-
///< tensorRank - 1 dimensions.
9759+
///< TensorRank - 1 dimensions.
97589760
const int *PixelBoxLowerCorner, ///< [in] Array containing DHW dimensions of lower box corner.
97599761
const int *PixelBoxUpperCorner, ///< [in] Array containing DHW dimensions of upper box corner.
97609762
uint32_t ChannelsPerPixel, ///< [in] Number of channels per pixel.
97619763
uint32_t PixelsPerColumn, ///< [in] Number of pixels per column.
9762-
const uint32_t *ElementStrides, ///< [in] Array containing traversal stride in each of the tensorRank
9764+
const uint32_t *ElementStrides, ///< [in] Array containing traversal stride in each of the TensorRank
97639765
///< dimensions.
97649766
ur_exp_tensor_map_interleave_flags_t Interleave, ///< [in] Type of interleaved layout the tensor addresses
97659767
ur_exp_tensor_map_swizzle_flags_t Swizzle, ///< [in] Bank swizzling pattern inside shared memory
97669768
ur_exp_tensor_map_l2_promotion_flags_t L2Promotion, ///< [in] L2 promotion size.
9767-
ur_exp_tensor_map_oob_fill_flags_t OobFill, ///< [in] Indicate whether zero or special NaN constant will be used to
9768-
///< fill out-of-bound elements.
9769+
ur_exp_tensor_map_oob_fill_flags_t OobFill, ///< [in] Indicates whether zero or special NaN constant will be used to
9770+
///< fill out-of-bounds elements.
97699771
ur_exp_tensor_map_handle_t *hTensorMap ///< [out] Handle of the tensor map object.
97709772
);
97719773

@@ -9795,6 +9797,8 @@ urTensorMapEncodeIm2ColExp(
97959797
/// + `NULL == BoxDim`
97969798
/// + `NULL == ElementStrides`
97979799
/// + `NULL == hTensorMap`
9800+
/// - ::UR_RESULT_ERROR_INVALID_ARGUMENT
9801+
/// + `TensorRank < 3`
97989802
UR_APIEXPORT ur_result_t UR_APICALL
97999803
urTensorMapEncodeTiledExp(
98009804
ur_device_handle_t hDevice, ///< [in] Handle of the device object.
@@ -9804,17 +9808,17 @@ urTensorMapEncodeTiledExp(
98049808
const uint64_t *GlobalDim, ///< [in] Array containing tensor size (number of elements) along each of
98059809
///< the TensorRank dimensions.
98069810
const uint64_t *GlobalStrides, ///< [in] Array containing stride size (in bytes) along each of the
9807-
///< tensorRank - 1 dimensions.
9811+
///< TensorRank - 1 dimensions.
98089812
const uint32_t *BoxDim, ///< [in] Array containing traversal box size (number of elments) along
9809-
///< each of the tensorRank dimensions. Specifies how many elements to be
9813+
///< each of the TensorRank dimensions. Specifies how many elements to be
98109814
///< traversed along each tensor dimension.
9811-
const uint32_t *ElementStrides, ///< [in] Array containing traversal stride in each of the tensorRank
9815+
const uint32_t *ElementStrides, ///< [in] Array containing traversal stride in each of the TensorRank
98129816
///< dimensions.
98139817
ur_exp_tensor_map_interleave_flags_t Interleave, ///< [in] Type of interleaved layout the tensor addresses
98149818
ur_exp_tensor_map_swizzle_flags_t Swizzle, ///< [in] Bank swizzling pattern inside shared memory
98159819
ur_exp_tensor_map_l2_promotion_flags_t L2Promotion, ///< [in] L2 promotion size.
9816-
ur_exp_tensor_map_oob_fill_flags_t OobFill, ///< [in] Indicate whether zero or special NaN constant will be used to
9817-
///< fill out-of-bound elements.
9820+
ur_exp_tensor_map_oob_fill_flags_t OobFill, ///< [in] Indicates whether zero or special NaN constant will be used to
9821+
///< fill out-of-bounds elements.
98189822
ur_exp_tensor_map_handle_t *hTensorMap ///< [out] Handle of the tensor map object.
98199823
);
98209824

scripts/core/exp-tensor-map.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#
1010
--- #--------------------------------------------------------------------------
1111
type: header
12-
desc: "Intel $OneApi Unified Runtime Experimental API for enqueuing work through native APIs"
12+
desc: "Intel $OneApi Unified Runtime Experimental API for mapping tensor objects"
1313
ordinal: "100"
1414

1515
--- #--------------------------------------------------------------------------
@@ -125,7 +125,7 @@ params:
125125
desc: "[in] Array containing tensor size (number of elements) along each of the TensorRank dimensions."
126126
- type: const uint64_t*
127127
name: GlobalStrides
128-
desc: "[in] Array containing stride size (in bytes) along each of the tensorRank - 1 dimensions."
128+
desc: "[in] Array containing stride size (in bytes) along each of the TensorRank - 1 dimensions."
129129
- type: const int*
130130
name: PixelBoxLowerCorner
131131
desc: "[in] Array containing DHW dimensions of lower box corner."
@@ -140,7 +140,7 @@ params:
140140
desc: "[in] Number of pixels per column."
141141
- type: const uint32_t*
142142
name: ElementStrides
143-
desc: "[in] Array containing traversal stride in each of the tensorRank dimensions."
143+
desc: "[in] Array containing traversal stride in each of the TensorRank dimensions."
144144
- type: $x_exp_tensor_map_interleave_flags_t
145145
name: Interleave
146146
desc: "[in] Type of interleaved layout the tensor addresses"
@@ -152,10 +152,13 @@ params:
152152
desc: "[in] L2 promotion size."
153153
- type: $x_exp_tensor_map_oob_fill_flags_t
154154
name: OobFill
155-
desc: "[in] Indicate whether zero or special NaN constant will be used to fill out-of-bound elements."
155+
desc: "[in] Indicates whether zero or special NaN constant will be used to fill out-of-bounds elements."
156156
- type: $x_exp_tensor_map_handle_t*
157157
name: hTensorMap
158158
desc: "[out] Handle of the tensor map object."
159+
returns:
160+
- $X_RESULT_ERROR_INVALID_ARGUMENT:
161+
- "`TensorRank < 3`"
159162

160163
--- #--------------------------------------------------------------------------
161164
type: function
@@ -182,13 +185,13 @@ params:
182185
desc: "[in] Array containing tensor size (number of elements) along each of the TensorRank dimensions."
183186
- type: const uint64_t*
184187
name: GlobalStrides
185-
desc: "[in] Array containing stride size (in bytes) along each of the tensorRank - 1 dimensions."
188+
desc: "[in] Array containing stride size (in bytes) along each of the TensorRank - 1 dimensions."
186189
- type: const uint32_t*
187190
name: BoxDim
188-
desc: "[in] Array containing traversal box size (number of elments) along each of the tensorRank dimensions. Specifies how many elements to be traversed along each tensor dimension."
191+
desc: "[in] Array containing traversal box size (number of elments) along each of the TensorRank dimensions. Specifies how many elements to be traversed along each tensor dimension."
189192
- type: const uint32_t*
190193
name: ElementStrides
191-
desc: "[in] Array containing traversal stride in each of the tensorRank dimensions."
194+
desc: "[in] Array containing traversal stride in each of the TensorRank dimensions."
192195
- type: $x_exp_tensor_map_interleave_flags_t
193196
name: Interleave
194197
desc: "[in] Type of interleaved layout the tensor addresses"
@@ -200,8 +203,11 @@ params:
200203
desc: "[in] L2 promotion size."
201204
- type: $x_exp_tensor_map_oob_fill_flags_t
202205
name: OobFill
203-
desc: "[in] Indicate whether zero or special NaN constant will be used to fill out-of-bound elements."
206+
desc: "[in] Indicates whether zero or special NaN constant will be used to fill out-of-bounds elements."
204207
- type: $x_exp_tensor_map_handle_t*
205208
name: hTensorMap
206209
desc: "[out] Handle of the tensor map object."
210+
returns:
211+
- $X_RESULT_ERROR_INVALID_ARGUMENT:
212+
- "`TensorRank < 3`"
207213

source/adapters/cuda/tensor_map.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ struct ur_exp_tensor_map_handle_t_ {
1818
};
1919

2020
#define CONVERT(URTYPE, CUTYPE) \
21-
if (URTYPE & UrType) \
22-
return CUTYPE;
21+
if ((URTYPE)&UrType) \
22+
return (CUTYPE);
2323

2424
inline CUtensorMapDataType
2525
convertUrToCuDataType(ur_exp_tensor_map_data_type_flags_t UrType) {
@@ -71,7 +71,7 @@ convertUrToCuSwizzle(ur_exp_tensor_map_swizzle_flags_t UrType) {
7171
}
7272

7373
CUtensorMapL2promotion
74-
convertUrToL2promotion(ur_exp_tensor_map_l2_promotion_flags_t UrType) {
74+
convertUrToCuL2Promotion(ur_exp_tensor_map_l2_promotion_flags_t UrType) {
7575
CONVERT(UR_EXP_TENSOR_MAP_L2_PROMOTION_FLAG_NONE,
7676
CU_TENSOR_MAP_L2_PROMOTION_NONE);
7777
CONVERT(UR_EXP_TENSOR_MAP_L2_PROMOTION_FLAG_64B,
@@ -84,7 +84,7 @@ convertUrToL2promotion(ur_exp_tensor_map_l2_promotion_flags_t UrType) {
8484
}
8585

8686
CUtensorMapFloatOOBfill
87-
convertUrToCuOOBfill(ur_exp_tensor_map_oob_fill_flags_t UrType) {
87+
convertUrToCuOobFill(ur_exp_tensor_map_oob_fill_flags_t UrType) {
8888
CONVERT(UR_EXP_TENSOR_MAP_OOB_FILL_FLAG_NONE,
8989
CU_TENSOR_MAP_FLOAT_OOB_FILL_NONE);
9090
CONVERT(UR_EXP_TENSOR_MAP_OOB_FILL_FLAG_REQUEST_ZERO_FMA,
@@ -111,7 +111,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urTensorMapEncodeIm2ColExp(
111111
GlobalAddress, GlobalDim, GlobalStrides, PixelBoxLowerCorner,
112112
PixelBoxUpperCorner, ChannelsPerPixel, PixelsPerColumn, ElementStrides,
113113
convertUrToCuInterleave(Interleave), convertUrToCuSwizzle(Swizzle),
114-
convertUrToL2promotion(L2Promotion), convertUrToCuOOBfill(OobFill)));
114+
convertUrToCuL2Promotion(L2Promotion), convertUrToCuOobFill(OobFill)));
115115
} catch (ur_result_t Err) {
116116
return Err;
117117
}
@@ -134,7 +134,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urTensorMapEncodeTiledExp(
134134
&(*hTensorMap)->Map, convertUrToCuDataType(TensorMapType), TensorRank,
135135
GlobalAddress, GlobalDim, GlobalStrides, BoxDim, ElementStrides,
136136
convertUrToCuInterleave(Interleave), convertUrToCuSwizzle(Swizzle),
137-
convertUrToL2promotion(L2Promotion), convertUrToCuOOBfill(OobFill)));
137+
convertUrToCuL2Promotion(L2Promotion), convertUrToCuOobFill(OobFill)));
138138
} catch (ur_result_t Err) {
139139
return Err;
140140
}

source/adapters/mock/ur_mockddi.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10191,15 +10191,15 @@ __urdlllocal ur_result_t UR_APICALL urTensorMapEncodeIm2ColExp(
1019110191
///< the TensorRank dimensions.
1019210192
const uint64_t *
1019310193
GlobalStrides, ///< [in] Array containing stride size (in bytes) along each of the
10194-
///< tensorRank - 1 dimensions.
10194+
///< TensorRank - 1 dimensions.
1019510195
const int *
1019610196
PixelBoxLowerCorner, ///< [in] Array containing DHW dimensions of lower box corner.
1019710197
const int *
1019810198
PixelBoxUpperCorner, ///< [in] Array containing DHW dimensions of upper box corner.
1019910199
uint32_t ChannelsPerPixel, ///< [in] Number of channels per pixel.
1020010200
uint32_t PixelsPerColumn, ///< [in] Number of pixels per column.
1020110201
const uint32_t *
10202-
ElementStrides, ///< [in] Array containing traversal stride in each of the tensorRank
10202+
ElementStrides, ///< [in] Array containing traversal stride in each of the TensorRank
1020310203
///< dimensions.
1020410204
ur_exp_tensor_map_interleave_flags_t
1020510205
Interleave, ///< [in] Type of interleaved layout the tensor addresses
@@ -10208,8 +10208,8 @@ __urdlllocal ur_result_t UR_APICALL urTensorMapEncodeIm2ColExp(
1020810208
ur_exp_tensor_map_l2_promotion_flags_t
1020910209
L2Promotion, ///< [in] L2 promotion size.
1021010210
ur_exp_tensor_map_oob_fill_flags_t
10211-
OobFill, ///< [in] Indicate whether zero or special NaN constant will be used to
10212-
///< fill out-of-bound elements.
10211+
OobFill, ///< [in] Indicates whether zero or special NaN constant will be used to
10212+
///< fill out-of-bounds elements.
1021310213
ur_exp_tensor_map_handle_t
1021410214
*hTensorMap ///< [out] Handle of the tensor map object.
1021510215
) try {
@@ -10281,13 +10281,13 @@ __urdlllocal ur_result_t UR_APICALL urTensorMapEncodeTiledExp(
1028110281
///< the TensorRank dimensions.
1028210282
const uint64_t *
1028310283
GlobalStrides, ///< [in] Array containing stride size (in bytes) along each of the
10284-
///< tensorRank - 1 dimensions.
10284+
///< TensorRank - 1 dimensions.
1028510285
const uint32_t *
1028610286
BoxDim, ///< [in] Array containing traversal box size (number of elments) along
10287-
///< each of the tensorRank dimensions. Specifies how many elements to be
10287+
///< each of the TensorRank dimensions. Specifies how many elements to be
1028810288
///< traversed along each tensor dimension.
1028910289
const uint32_t *
10290-
ElementStrides, ///< [in] Array containing traversal stride in each of the tensorRank
10290+
ElementStrides, ///< [in] Array containing traversal stride in each of the TensorRank
1029110291
///< dimensions.
1029210292
ur_exp_tensor_map_interleave_flags_t
1029310293
Interleave, ///< [in] Type of interleaved layout the tensor addresses
@@ -10296,8 +10296,8 @@ __urdlllocal ur_result_t UR_APICALL urTensorMapEncodeTiledExp(
1029610296
ur_exp_tensor_map_l2_promotion_flags_t
1029710297
L2Promotion, ///< [in] L2 promotion size.
1029810298
ur_exp_tensor_map_oob_fill_flags_t
10299-
OobFill, ///< [in] Indicate whether zero or special NaN constant will be used to
10300-
///< fill out-of-bound elements.
10299+
OobFill, ///< [in] Indicates whether zero or special NaN constant will be used to
10300+
///< fill out-of-bounds elements.
1030110301
ur_exp_tensor_map_handle_t
1030210302
*hTensorMap ///< [out] Handle of the tensor map object.
1030310303
) try {

source/loader/layers/tracing/ur_trcddi.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8017,15 +8017,15 @@ __urdlllocal ur_result_t UR_APICALL urTensorMapEncodeIm2ColExp(
80178017
///< the TensorRank dimensions.
80188018
const uint64_t *
80198019
GlobalStrides, ///< [in] Array containing stride size (in bytes) along each of the
8020-
///< tensorRank - 1 dimensions.
8020+
///< TensorRank - 1 dimensions.
80218021
const int *
80228022
PixelBoxLowerCorner, ///< [in] Array containing DHW dimensions of lower box corner.
80238023
const int *
80248024
PixelBoxUpperCorner, ///< [in] Array containing DHW dimensions of upper box corner.
80258025
uint32_t ChannelsPerPixel, ///< [in] Number of channels per pixel.
80268026
uint32_t PixelsPerColumn, ///< [in] Number of pixels per column.
80278027
const uint32_t *
8028-
ElementStrides, ///< [in] Array containing traversal stride in each of the tensorRank
8028+
ElementStrides, ///< [in] Array containing traversal stride in each of the TensorRank
80298029
///< dimensions.
80308030
ur_exp_tensor_map_interleave_flags_t
80318031
Interleave, ///< [in] Type of interleaved layout the tensor addresses
@@ -8034,8 +8034,8 @@ __urdlllocal ur_result_t UR_APICALL urTensorMapEncodeIm2ColExp(
80348034
ur_exp_tensor_map_l2_promotion_flags_t
80358035
L2Promotion, ///< [in] L2 promotion size.
80368036
ur_exp_tensor_map_oob_fill_flags_t
8037-
OobFill, ///< [in] Indicate whether zero or special NaN constant will be used to
8038-
///< fill out-of-bound elements.
8037+
OobFill, ///< [in] Indicates whether zero or special NaN constant will be used to
8038+
///< fill out-of-bounds elements.
80398039
ur_exp_tensor_map_handle_t
80408040
*hTensorMap ///< [out] Handle of the tensor map object.
80418041
) {
@@ -8100,13 +8100,13 @@ __urdlllocal ur_result_t UR_APICALL urTensorMapEncodeTiledExp(
81008100
///< the TensorRank dimensions.
81018101
const uint64_t *
81028102
GlobalStrides, ///< [in] Array containing stride size (in bytes) along each of the
8103-
///< tensorRank - 1 dimensions.
8103+
///< TensorRank - 1 dimensions.
81048104
const uint32_t *
81058105
BoxDim, ///< [in] Array containing traversal box size (number of elments) along
8106-
///< each of the tensorRank dimensions. Specifies how many elements to be
8106+
///< each of the TensorRank dimensions. Specifies how many elements to be
81078107
///< traversed along each tensor dimension.
81088108
const uint32_t *
8109-
ElementStrides, ///< [in] Array containing traversal stride in each of the tensorRank
8109+
ElementStrides, ///< [in] Array containing traversal stride in each of the TensorRank
81108110
///< dimensions.
81118111
ur_exp_tensor_map_interleave_flags_t
81128112
Interleave, ///< [in] Type of interleaved layout the tensor addresses
@@ -8115,8 +8115,8 @@ __urdlllocal ur_result_t UR_APICALL urTensorMapEncodeTiledExp(
81158115
ur_exp_tensor_map_l2_promotion_flags_t
81168116
L2Promotion, ///< [in] L2 promotion size.
81178117
ur_exp_tensor_map_oob_fill_flags_t
8118-
OobFill, ///< [in] Indicate whether zero or special NaN constant will be used to
8119-
///< fill out-of-bound elements.
8118+
OobFill, ///< [in] Indicates whether zero or special NaN constant will be used to
8119+
///< fill out-of-bounds elements.
81208120
ur_exp_tensor_map_handle_t
81218121
*hTensorMap ///< [out] Handle of the tensor map object.
81228122
) {

0 commit comments

Comments
 (0)