Remove superfluous const_casts

Signed-off-by: Patryk Wrobel <patryk.wrobel@intel.com>
This commit is contained in:
Patryk Wrobel
2022-09-06 10:39:00 +00:00
committed by Compute-Runtime-Automation
parent 16d9000429
commit 53c127e64c
14 changed files with 32 additions and 32 deletions

View File

@@ -172,7 +172,7 @@ void testAppendMemoryCopyRegion(ze_context_handle_t &context, ze_device_handle_t
// Perform the copy
SUCCESS_OR_TERMINATE(zeCommandListAppendMemoryCopyRegion(cmdList, dstBuffer, &dstRegion, dstWidth, 0,
const_cast<const void *>(srcBuffer), &srcRegion, srcWidth, 0,
srcBuffer, &srcRegion, srcWidth, 0,
useSyncCmdQ ? nullptr : event,
0, nullptr));
@@ -241,7 +241,7 @@ void testAppendGpuKernel(ze_context_handle_t &context, ze_device_handle_t &devic
void *dstBuffer = nullptr;
std::string buildLog;
auto moduleBinary = compileToSpirV(const_cast<const char *>(memcpyBytesTestKernelSrc), "", buildLog);
auto moduleBinary = compileToSpirV(memcpyBytesTestKernelSrc, "", buildLog);
if (buildLog.size() > 0) {
std::cout << "Build log " << buildLog;
}

View File

@@ -176,7 +176,7 @@ void testAppendMemoryCopy2DRegion(ze_context_handle_t &context, ze_device_handle
// Perform the copy
SUCCESS_OR_TERMINATE(zeCommandListAppendMemoryCopyRegion(cmdList, dstBuffer, &dstRegion, dstWidth, 0,
const_cast<const void *>(srcBuffer), &srcRegion, srcWidth, 0,
srcBuffer, &srcRegion, srcWidth, 0,
nullptr, 0, nullptr));
SUCCESS_OR_TERMINATE(zeCommandListClose(cmdList));
@@ -437,7 +437,7 @@ void testAppendMemoryCopy3DRegion(ze_context_handle_t &context, ze_device_handle
// Perform the copy
SUCCESS_OR_TERMINATE(zeCommandListAppendMemoryCopyRegion(cmdList, dstBuffer, &dstRegion, dstWidth, (dstWidth * dstHeight),
const_cast<const void *>(srcBuffer), &srcRegion, srcWidth, (srcWidth * srcHeight),
srcBuffer, &srcRegion, srcWidth, (srcWidth * srcHeight),
nullptr, 0, nullptr));
SUCCESS_OR_TERMINATE(zeCommandListClose(cmdList));

View File

@@ -54,7 +54,7 @@ void testAppendImageCopy(ze_context_handle_t &context, ze_device_handle_t &devic
ze_image_region_t srcRegion = {0, 0, 0, width, height, depth};
SUCCESS_OR_TERMINATE(
zeImageCreate(context, device, const_cast<const ze_image_desc_t *>(&srcImgDesc), &srcImg));
zeImageCreate(context, device, &srcImgDesc, &srcImg));
ze_image_desc_t dstImgDesc = {ZE_STRUCTURE_TYPE_IMAGE_DESC,
nullptr,
@@ -72,7 +72,7 @@ void testAppendImageCopy(ze_context_handle_t &context, ze_device_handle_t &devic
ze_image_region_t dstRegion = {0, 0, 0, width, height, depth};
SUCCESS_OR_TERMINATE(
zeImageCreate(context, device, const_cast<const ze_image_desc_t *>(&dstImgDesc), &dstImg));
zeImageCreate(context, device, &dstImgDesc, &dstImg));
uint8_t *srcBuffer = new uint8_t[size];
uint8_t *dstBuffer = new uint8_t[size];

View File

@@ -251,7 +251,7 @@ void testRegionCopyOf2DSharedMem(ze_context_handle_t &context, ze_device_handle_
// Perform the copy
SUCCESS_OR_TERMINATE(zeCommandListAppendMemoryCopyRegion(cmdList, dstBuffer, &dstRegion, dstWidth, 0,
const_cast<const void *>(srcBuffer), &srcRegion, srcWidth, 0,
srcBuffer, &srcRegion, srcWidth, 0,
nullptr, 0, nullptr));
SUCCESS_OR_TERMINATE(zeCommandListClose(cmdList));
@@ -501,7 +501,7 @@ void testRegionCopyOf3DSharedMem(ze_context_handle_t &context, ze_device_handle_
// Perform the copy
SUCCESS_OR_TERMINATE(zeCommandListAppendMemoryCopyRegion(cmdList, dstBuffer, &dstRegion, dstWidth, (dstWidth * dstHeight),
const_cast<const void *>(srcBuffer), &srcRegion, srcWidth, (srcWidth * srcHeight),
srcBuffer, &srcRegion, srcWidth, (srcWidth * srcHeight),
nullptr, 0, nullptr));
SUCCESS_OR_TERMINATE(zeCommandListClose(cmdList));

View File

@@ -592,7 +592,7 @@ void testAppendMemoryCopy2(ze_context_handle_t &context, ze_device_handle_t &dev
// Perform the copy
SUCCESS_OR_TERMINATE(cmdListDdiTable.pfnAppendMemoryCopyRegion(cmdList, dstBuffer, &dstRegion, dstWidth, 0,
const_cast<const void *>(srcBuffer), &srcRegion, srcWidth, 0,
srcBuffer, &srcRegion, srcWidth, 0,
nullptr, 0, nullptr));
SUCCESS_OR_TERMINATE(cmdListDdiTable.pfnClose(cmdList));

View File

@@ -141,7 +141,7 @@ int main(int argc, char *argv[]) {
std::cout << "reading export module for spirv\n";
}
std::string buildLog;
auto exportBinaryModule = compileToSpirV(const_cast<const char *>(exportModuleSrcValue), "", buildLog);
auto exportBinaryModule = compileToSpirV(exportModuleSrcValue, "", buildLog);
if (buildLog.size() > 0) {
std::cout << "Build log " << buildLog;
}
@@ -190,7 +190,7 @@ int main(int argc, char *argv[]) {
if (verbose) {
std::cout << "reading import module for spirv\n";
}
auto importBinaryModule = compileToSpirV(const_cast<const char *>(importModuleSrcValue), "", buildLog);
auto importBinaryModule = compileToSpirV(importModuleSrcValue, "", buildLog);
if (buildLog.size() > 0) {
std::cout << "Build log " << buildLog;
}

View File

@@ -84,7 +84,7 @@ void testAppendImageFunction(ze_context_handle_t &context,
ze_image_region_t srcRegion = {inOffsetX, inOffsetY, inOffsetZ, hostWidth, hostHeight, hostDepth};
SUCCESS_OR_TERMINATE(
zeImageCreate(context, device, const_cast<const ze_image_desc_t *>(&srcImgDesc), &srcImg));
zeImageCreate(context, device, &srcImgDesc, &srcImg));
ze_image_desc_t dstImgDesc = {ZE_STRUCTURE_TYPE_IMAGE_DESC,
nullptr,
@@ -102,7 +102,7 @@ void testAppendImageFunction(ze_context_handle_t &context,
ze_image_region_t dstRegion = {outOffsetX, outOffsetY, outOffsetZ, hostWidth, hostHeight, hostDepth};
SUCCESS_OR_TERMINATE(
zeImageCreate(context, device, const_cast<const ze_image_desc_t *>(&dstImgDesc), &dstImg));
zeImageCreate(context, device, &dstImgDesc, &dstImg));
uint32_t *srcBuffer = new uint32_t[hostSize];
uint32_t *dstBuffer = new uint32_t[hostSize];

View File

@@ -84,7 +84,7 @@ void testAppendImageViewNV12Copy(ze_context_handle_t &context, ze_device_handle_
ze_image_handle_t srcImg;
SUCCESS_OR_TERMINATE(
zeImageCreate(context, device, const_cast<const ze_image_desc_t *>(&srcImgDesc), &srcImg));
zeImageCreate(context, device, &srcImgDesc, &srcImg));
// create image_veiw for Y plane
ze_image_view_planar_exp_desc_t planeYdesc = {};
@@ -329,7 +329,7 @@ void testAppendImageViewRGBPCopy(ze_context_handle_t &context, ze_device_handle_
ze_image_handle_t srcImg;
SUCCESS_OR_TERMINATE(
zeImageCreate(context, device, const_cast<const ze_image_desc_t *>(&srcImgDesc), &srcImg));
zeImageCreate(context, device, &srcImgDesc, &srcImg));
// create image_veiw for Y plane
ze_image_view_planar_exp_desc_t planeYdesc = {};

View File

@@ -88,7 +88,7 @@ int main(int argc, char *argv[]) {
kernel.resize(deviceCount);
std::string buildLog;
auto moduleBinary = compileToSpirV(const_cast<const char *>(memcpyBytesTestKernelSrc), "", buildLog);
auto moduleBinary = compileToSpirV(memcpyBytesTestKernelSrc, "", buildLog);
if (buildLog.size() > 0) {
std::cout << "Build log " << buildLog;
}

View File

@@ -607,7 +607,7 @@ struct ModuleSpecConstantsFixture : public DeviceFixture {
ze_module_program_exp_desc_t staticLinkModuleDesc = {ZE_STRUCTURE_TYPE_MODULE_PROGRAM_EXP_DESC};
std::vector<const uint8_t *> inputSpirVs;
std::vector<size_t> inputSizes;
std::vector<ze_module_constants_t *> specConstantsArray;
std::vector<const ze_module_constants_t *> specConstantsArray;
combinedModuleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV;
combinedModuleDesc.pNext = &staticLinkModuleDesc;
@@ -632,7 +632,7 @@ struct ModuleSpecConstantsFixture : public DeviceFixture {
staticLinkModuleDesc.count = 2;
staticLinkModuleDesc.inputSizes = inputSizes.data();
staticLinkModuleDesc.pInputModules = inputSpirVs.data();
staticLinkModuleDesc.pConstants = const_cast<const ze_module_constants_t **>(specConstantsArray.data());
staticLinkModuleDesc.pConstants = specConstantsArray.data();
auto module = new Module(device, nullptr, ModuleType::User);
module->translationUnit.reset(mockTranslationUnit);
@@ -786,7 +786,7 @@ TEST_F(ModuleSpecConstantsLongTests, givenSpecializationConstantsSetWhenCompiler
ze_module_program_exp_desc_t staticLinkModuleDesc = {ZE_STRUCTURE_TYPE_MODULE_PROGRAM_EXP_DESC};
std::vector<const uint8_t *> inputSpirVs;
std::vector<size_t> inputSizes;
std::vector<ze_module_constants_t *> specConstantsArray;
std::vector<const ze_module_constants_t *> specConstantsArray;
combinedModuleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV;
combinedModuleDesc.pNext = &staticLinkModuleDesc;
@@ -811,7 +811,7 @@ TEST_F(ModuleSpecConstantsLongTests, givenSpecializationConstantsSetWhenCompiler
staticLinkModuleDesc.count = 2;
staticLinkModuleDesc.inputSizes = inputSizes.data();
staticLinkModuleDesc.pInputModules = inputSpirVs.data();
staticLinkModuleDesc.pConstants = const_cast<const ze_module_constants_t **>(specConstantsArray.data());
staticLinkModuleDesc.pConstants = specConstantsArray.data();
auto module = new Module(device, nullptr, ModuleType::User);
module->translationUnit.reset(mockTranslationUnit);
@@ -931,13 +931,13 @@ struct ModuleStaticLinkFixture : public DeviceFixture {
setupExpProgramDesc(ZE_MODULE_FORMAT_IL_SPIRV, testMultiple);
std::vector<char *> buildFlags;
std::vector<const char *> buildFlags;
std::string module1BuildFlags("-ze-opt-disable");
std::string module2BuildFlags("-ze-opt-greater-than-4GB-buffer-required");
buildFlags.push_back(const_cast<char *>(module1BuildFlags.c_str()));
buildFlags.push_back(const_cast<char *>(module2BuildFlags.c_str()));
buildFlags.push_back(module1BuildFlags.c_str());
buildFlags.push_back(module2BuildFlags.c_str());
staticLinkModuleDesc.pBuildFlags = const_cast<const char **>(buildFlags.data());
staticLinkModuleDesc.pBuildFlags = buildFlags.data();
auto module = new Module(device, nullptr, ModuleType::User);
module->translationUnit.reset(mockTranslationUnit);
@@ -957,11 +957,11 @@ struct ModuleStaticLinkFixture : public DeviceFixture {
setupExpProgramDesc(ZE_MODULE_FORMAT_IL_SPIRV, testSingle);
std::vector<char *> buildFlags;
std::vector<const char *> buildFlags;
std::string module1BuildFlags("-ze-opt-disable");
buildFlags.push_back(const_cast<char *>(module1BuildFlags.c_str()));
buildFlags.push_back(module1BuildFlags.c_str());
staticLinkModuleDesc.pBuildFlags = const_cast<const char **>(buildFlags.data());
staticLinkModuleDesc.pBuildFlags = buildFlags.data();
auto module = new Module(device, nullptr, ModuleType::User);
module->translationUnit.reset(mockTranslationUnit);

View File

@@ -131,7 +131,7 @@ ClDevice *ClDevice::getNearestGenericSubDevice(uint32_t deviceId) {
}
if (subDevices.empty() || !getDevice().hasRootCsr()) {
return const_cast<ClDevice *>(this);
return this;
}
UNRECOVERABLE_IF(deviceId >= subDevices.size());
return subDevices[deviceId].get();

View File

@@ -521,7 +521,7 @@ Device *Device::getNearestGenericSubDevice(uint32_t deviceId) {
}
if (subdevices.empty() || !hasRootCsr()) {
return const_cast<Device *>(this);
return this;
}
UNRECOVERABLE_IF(deviceId >= subdevices.size());
return subdevices[deviceId];

View File

@@ -1034,7 +1034,7 @@ bool Drm::queryEngineInfo(bool isSysmanEnabled) {
memInfo->assignRegionsFromDistances(distanceInfos);
auto &multiTileArchInfo = const_cast<GT_MULTI_TILE_ARCH_INFO &>(hwInfo->gtSystemInfo.MultiTileArchInfo);
auto &multiTileArchInfo = hwInfo->gtSystemInfo.MultiTileArchInfo;
multiTileArchInfo.IsValid = true;
multiTileArchInfo.TileCount = tileCount;
multiTileArchInfo.TileMask = static_cast<uint8_t>(maxNBitValue(tileCount));

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -15,7 +15,7 @@ void Wddm::setGmmInputArgs(void *args) {
gmmInArgs->stAdapterBDF = this->adapterBDF;
gmmInArgs->ClientType = GMM_CLIENT::GMM_OCL_VISTA;
gmmInArgs->DeviceRegistryPath = const_cast<char *>(deviceRegistryPath.c_str());
gmmInArgs->DeviceRegistryPath = deviceRegistryPath.c_str();
}
} // namespace NEO