Skip to content

Commit 2d9e9a5

Browse files
authored
[UR][L0] Remove dead image code for int/unit format type (#18967)
- Remove switch case for 8,16,32 now that all format int sizes are supported. Signed-off-by: Neil R. Spruit <[email protected]>
1 parent 1e2eede commit 2d9e9a5

File tree

1 file changed

+6
-26
lines changed

1 file changed

+6
-26
lines changed

unified-runtime/source/adapters/level_zero/image_common.cpp

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -166,41 +166,21 @@ ur_result_t ze2urImageFormat(const ze_image_format_t &ZeImageFormat,
166166
ur_image_channel_type_t ChannelType;
167167
switch (ZeImageFormat.type) {
168168
case ZE_IMAGE_FORMAT_TYPE_UINT:
169-
switch (ZeImageFormatTypeSize) {
170-
case 8:
169+
if (ZeImageFormatTypeSize == 8) {
171170
ChannelType = UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8;
172-
break;
173-
case 16:
171+
} else if (ZeImageFormatTypeSize == 16) {
174172
ChannelType = UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16;
175-
break;
176-
case 32:
173+
} else if (ZeImageFormatTypeSize == 32) {
177174
ChannelType = UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32;
178-
break;
179-
default:
180-
UR_LOG(ERR,
181-
"ze2urImageFormat: unexpected image format type size: size "
182-
"= {}",
183-
ZeImageFormatTypeSize);
184-
return UR_RESULT_ERROR_INVALID_VALUE;
185175
}
186176
break;
187177
case ZE_IMAGE_FORMAT_TYPE_SINT:
188-
switch (ZeImageFormatTypeSize) {
189-
case 8:
178+
if (ZeImageFormatTypeSize == 8) {
190179
ChannelType = UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8;
191-
break;
192-
case 16:
180+
} else if (ZeImageFormatTypeSize == 16) {
193181
ChannelType = UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16;
194-
break;
195-
case 32:
182+
} else if (ZeImageFormatTypeSize == 32) {
196183
ChannelType = UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32;
197-
break;
198-
default:
199-
UR_LOG(ERR,
200-
"ze2urImageFormat: unexpected image format type size: size "
201-
"= {}",
202-
ZeImageFormatTypeSize);
203-
return UR_RESULT_ERROR_INVALID_VALUE;
204184
}
205185
break;
206186
case ZE_IMAGE_FORMAT_TYPE_UNORM:

0 commit comments

Comments
 (0)