Merge pull request #289 from COM8/compiler_warnings

Fixed compiler warnings
This commit is contained in:
Alejandro Saucedo 2022-05-20 10:11:16 +02:00 committed by GitHub
commit e2485bbc9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 35 additions and 37 deletions

View file

@ -2069,15 +2069,15 @@ class Sequence : public std::enable_shared_from_this<Sequence>
* *
* @return Boolean stating if recording ongoing. * @return Boolean stating if recording ongoing.
*/ */
bool isRecording(); [[nodiscard]] bool isRecording() const;
/** /**
* Returns true if the sequence has been initialised, and it's based on the * Returns true if the sequence has been initialised, and it's based on the
* GPU resources being refrenced. * GPU resources being referenced.
* *
* @return Boolean stating if is initialized * @return Boolean stating if is initialized
*/ */
bool isInit(); [[nodiscard]] bool isInit() const;
/** /**
* Clears command buffer and triggers re-record of all the current * Clears command buffer and triggers re-record of all the current
@ -2092,7 +2092,7 @@ class Sequence : public std::enable_shared_from_this<Sequence>
* *
* @return Boolean stating if currently running. * @return Boolean stating if currently running.
*/ */
bool isRunning(); [[nodiscard]] bool isRunning() const;
/** /**
* Destroys and frees the GPU resources which include the buffer and memory * Destroys and frees the GPU resources which include the buffer and memory

View file

@ -31,7 +31,8 @@ debugMessageCallback(VkDebugReportFlagsEXT flags,
Manager::Manager() Manager::Manager()
: Manager(0) : Manager(0)
{} {
}
Manager::Manager(uint32_t physicalDeviceIndex, Manager::Manager(uint32_t physicalDeviceIndex,
const std::vector<uint32_t>& familyQueueIndices, const std::vector<uint32_t>& familyQueueIndices,
@ -282,10 +283,6 @@ Manager::createDevice(const std::vector<uint32_t>& familyQueueIndices,
if (this->mInstance == nullptr) { if (this->mInstance == nullptr) {
throw std::runtime_error("Kompute Manager instance is null"); throw std::runtime_error("Kompute Manager instance is null");
} }
if (physicalDeviceIndex < 0) {
throw std::runtime_error(
"Kompute Manager physical device index not provided");
}
this->mFreeDevice = true; this->mFreeDevice = true;
@ -321,12 +318,13 @@ Manager::createDevice(const std::vector<uint32_t>& familyQueueIndices,
physicalDeviceIndex, physicalDeviceIndex,
physicalDeviceProperties.deviceName); physicalDeviceProperties.deviceName);
if (!familyQueueIndices.size()) { if (familyQueueIndices.empty()) {
// Find compute queue // Find compute queue
std::vector<vk::QueueFamilyProperties> allQueueFamilyProperties = std::vector<vk::QueueFamilyProperties> allQueueFamilyProperties =
physicalDevice.getQueueFamilyProperties(); physicalDevice.getQueueFamilyProperties();
uint32_t computeQueueFamilyIndex = -1; uint32_t computeQueueFamilyIndex = 0;
bool computeQueueSupported = false;
for (uint32_t i = 0; i < allQueueFamilyProperties.size(); i++) { for (uint32_t i = 0; i < allQueueFamilyProperties.size(); i++) {
vk::QueueFamilyProperties queueFamilyProperties = vk::QueueFamilyProperties queueFamilyProperties =
allQueueFamilyProperties[i]; allQueueFamilyProperties[i];
@ -334,11 +332,12 @@ Manager::createDevice(const std::vector<uint32_t>& familyQueueIndices,
if (queueFamilyProperties.queueFlags & if (queueFamilyProperties.queueFlags &
vk::QueueFlagBits::eCompute) { vk::QueueFlagBits::eCompute) {
computeQueueFamilyIndex = i; computeQueueFamilyIndex = i;
computeQueueSupported = true;
break; break;
} }
} }
if (computeQueueFamilyIndex < 0) { if (!computeQueueSupported) {
throw std::runtime_error("Compute queue is not supported"); throw std::runtime_error("Compute queue is not supported");
} }

View file

@ -43,13 +43,13 @@ OpAlgoDispatch::record(const vk::CommandBuffer& commandBuffer)
} }
void void
OpAlgoDispatch::preEval(const vk::CommandBuffer& commandBuffer) OpAlgoDispatch::preEval(const vk::CommandBuffer& /*commandBuffer*/)
{ {
KP_LOG_DEBUG("Kompute OpAlgoDispatch preEval called"); KP_LOG_DEBUG("Kompute OpAlgoDispatch preEval called");
} }
void void
OpAlgoDispatch::postEval(const vk::CommandBuffer& commandBuffer) OpAlgoDispatch::postEval(const vk::CommandBuffer& /*commandBuffer*/)
{ {
KP_LOG_DEBUG("Kompute OpAlgoDispatch postSubmit called"); KP_LOG_DEBUG("Kompute OpAlgoDispatch postSubmit called");
} }

View file

@ -11,12 +11,12 @@ OpMemoryBarrier::OpMemoryBarrier(
const vk::PipelineStageFlagBits& srcStageMask, const vk::PipelineStageFlagBits& srcStageMask,
const vk::PipelineStageFlagBits& dstStageMask, const vk::PipelineStageFlagBits& dstStageMask,
bool barrierOnPrimary) bool barrierOnPrimary)
: mTensors(tensors) : mSrcAccessMask(srcAccessMask)
, mSrcAccessMask(srcAccessMask)
, mDstAccessMask(dstAccessMask) , mDstAccessMask(dstAccessMask)
, mSrcStageMask(srcStageMask) , mSrcStageMask(srcStageMask)
, mDstStageMask(dstStageMask) , mDstStageMask(dstStageMask)
, mBarrierOnPrimary(barrierOnPrimary) , mBarrierOnPrimary(barrierOnPrimary)
, mTensors(tensors)
{ {
KP_LOG_DEBUG("Kompute OpMemoryBarrier constructor"); KP_LOG_DEBUG("Kompute OpMemoryBarrier constructor");
} }
@ -52,13 +52,13 @@ OpMemoryBarrier::record(const vk::CommandBuffer& commandBuffer)
} }
void void
OpMemoryBarrier::preEval(const vk::CommandBuffer& commandBuffer) OpMemoryBarrier::preEval(const vk::CommandBuffer& /*commandBuffer*/)
{ {
KP_LOG_DEBUG("Kompute OpMemoryBarrier preEval called"); KP_LOG_DEBUG("Kompute OpMemoryBarrier preEval called");
} }
void void
OpMemoryBarrier::postEval(const vk::CommandBuffer& commandBuffer) OpMemoryBarrier::postEval(const vk::CommandBuffer& /*commandBuffer*/)
{ {
KP_LOG_DEBUG("Kompute OpMemoryBarrier postSubmit called"); KP_LOG_DEBUG("Kompute OpMemoryBarrier postSubmit called");
} }

View file

@ -50,13 +50,13 @@ OpTensorCopy::record(const vk::CommandBuffer& commandBuffer)
} }
void void
OpTensorCopy::preEval(const vk::CommandBuffer& commandBuffer) OpTensorCopy::preEval(const vk::CommandBuffer& /*commandBuffer*/)
{ {
KP_LOG_DEBUG("Kompute OpTensorCopy preEval called"); KP_LOG_DEBUG("Kompute OpTensorCopy preEval called");
} }
void void
OpTensorCopy::postEval(const vk::CommandBuffer& commandBuffer) OpTensorCopy::postEval(const vk::CommandBuffer& /*commandBuffer*/)
{ {
KP_LOG_DEBUG("Kompute OpTensorCopy postEval called"); KP_LOG_DEBUG("Kompute OpTensorCopy postEval called");

View file

@ -37,13 +37,13 @@ OpTensorSyncDevice::record(const vk::CommandBuffer& commandBuffer)
} }
void void
OpTensorSyncDevice::preEval(const vk::CommandBuffer& commandBuffer) OpTensorSyncDevice::preEval(const vk::CommandBuffer& /*commandBuffer*/)
{ {
KP_LOG_DEBUG("Kompute OpTensorSyncDevice preEval called"); KP_LOG_DEBUG("Kompute OpTensorSyncDevice preEval called");
} }
void void
OpTensorSyncDevice::postEval(const vk::CommandBuffer& commandBuffer) OpTensorSyncDevice::postEval(const vk::CommandBuffer& /*commandBuffer*/)
{ {
KP_LOG_DEBUG("Kompute OpTensorSyncDevice postEval called"); KP_LOG_DEBUG("Kompute OpTensorSyncDevice postEval called");
} }

View file

@ -52,13 +52,13 @@ OpTensorSyncLocal::record(const vk::CommandBuffer& commandBuffer)
} }
void void
OpTensorSyncLocal::preEval(const vk::CommandBuffer& commandBuffer) OpTensorSyncLocal::preEval(const vk::CommandBuffer& /*commandBuffer*/)
{ {
KP_LOG_DEBUG("Kompute OpTensorSyncLocal preEval called"); KP_LOG_DEBUG("Kompute OpTensorSyncLocal preEval called");
} }
void void
OpTensorSyncLocal::postEval(const vk::CommandBuffer& commandBuffer) OpTensorSyncLocal::postEval(const vk::CommandBuffer& /*commandBuffer*/)
{ {
KP_LOG_DEBUG("Kompute OpTensorSyncLocal postEval called"); KP_LOG_DEBUG("Kompute OpTensorSyncLocal postEval called");

View file

@ -174,19 +174,19 @@ Sequence::evalAwait(uint64_t waitFor)
} }
bool bool
Sequence::isRunning() Sequence::isRunning() const
{ {
return this->mIsRunning; return this->mIsRunning;
} }
bool bool
Sequence::isRecording() Sequence::isRecording() const
{ {
return this->mRecording; return this->mRecording;
} }
bool bool
Sequence::isInit() Sequence::isInit() const
{ {
return this->mDevice && this->mCommandPool && this->mCommandBuffer && return this->mDevice && this->mCommandPool && this->mCommandBuffer &&
this->mComputeQueue; this->mComputeQueue;
@ -304,9 +304,6 @@ Sequence::createCommandPool()
if (!this->mDevice) { if (!this->mDevice) {
throw std::runtime_error("Kompute Sequence device is null"); throw std::runtime_error("Kompute Sequence device is null");
} }
if (this->mQueueIndex < 0) {
throw std::runtime_error("Kompute Sequence queue index not provided");
}
this->mFreeCommandPool = true; this->mFreeCommandPool = true;

View file

@ -210,7 +210,7 @@ void
Tensor::recordCopyBuffer(const vk::CommandBuffer& commandBuffer, Tensor::recordCopyBuffer(const vk::CommandBuffer& commandBuffer,
std::shared_ptr<vk::Buffer> bufferFrom, std::shared_ptr<vk::Buffer> bufferFrom,
std::shared_ptr<vk::Buffer> bufferTo, std::shared_ptr<vk::Buffer> bufferTo,
vk::DeviceSize bufferSize, vk::DeviceSize /*bufferSize*/,
vk::BufferCopy copyRegion) vk::BufferCopy copyRegion)
{ {
@ -439,16 +439,18 @@ Tensor::allocateBindMemory(std::shared_ptr<vk::Buffer> buffer,
this->mDevice->getBufferMemoryRequirements(*buffer); this->mDevice->getBufferMemoryRequirements(*buffer);
uint32_t memoryTypeIndex = -1; uint32_t memoryTypeIndex = -1;
bool memoryTypeIndexFound = false;
for (uint32_t i = 0; i < memoryProperties.memoryTypeCount; i++) { for (uint32_t i = 0; i < memoryProperties.memoryTypeCount; i++) {
if (memoryRequirements.memoryTypeBits & (1 << i)) { if (memoryRequirements.memoryTypeBits & (1 << i)) {
if (((memoryProperties.memoryTypes[i]).propertyFlags & if (((memoryProperties.memoryTypes[i]).propertyFlags &
memoryPropertyFlags) == memoryPropertyFlags) { memoryPropertyFlags) == memoryPropertyFlags) {
memoryTypeIndex = i; memoryTypeIndex = i;
memoryTypeIndexFound = true;
break; break;
} }
} }
} }
if (memoryTypeIndex < 0) { if (!memoryTypeIndexFound) {
throw std::runtime_error( throw std::runtime_error(
"Memory type index for buffer creation not found"); "Memory type index for buffer creation not found");
} }

View file

@ -235,15 +235,15 @@ class Sequence : public std::enable_shared_from_this<Sequence>
* *
* @return Boolean stating if recording ongoing. * @return Boolean stating if recording ongoing.
*/ */
bool isRecording(); [[nodiscard]] bool isRecording() const;
/** /**
* Returns true if the sequence has been initialised, and it's based on the * Returns true if the sequence has been initialised, and it's based on the
* GPU resources being refrenced. * GPU resources being referenced.
* *
* @return Boolean stating if is initialized * @return Boolean stating if is initialized
*/ */
bool isInit(); [[nodiscard]] bool isInit() const;
/** /**
* Clears command buffer and triggers re-record of all the current * Clears command buffer and triggers re-record of all the current
@ -258,7 +258,7 @@ class Sequence : public std::enable_shared_from_this<Sequence>
* *
* @return Boolean stating if currently running. * @return Boolean stating if currently running.
*/ */
bool isRunning(); [[nodiscard]] bool isRunning() const;
/** /**
* Destroys and frees the GPU resources which include the buffer and memory * Destroys and frees the GPU resources which include the buffer and memory
@ -281,7 +281,7 @@ class Sequence : public std::enable_shared_from_this<Sequence>
// -------------- ALWAYS OWNED RESOURCES // -------------- ALWAYS OWNED RESOURCES
vk::Fence mFence; vk::Fence mFence;
std::vector<std::shared_ptr<OpBase>> mOperations; std::vector<std::shared_ptr<OpBase>> mOperations{};
std::shared_ptr<vk::QueryPool> timestampQueryPool = nullptr; std::shared_ptr<vk::QueryPool> timestampQueryPool = nullptr;
// State // State