diff --git a/hipamd/src/hip_formatting.hpp b/hipamd/src/hip_formatting.hpp index 577561ad73..f4ca3caafe 100644 --- a/hipamd/src/hip_formatting.hpp +++ b/hipamd/src/hip_formatting.hpp @@ -346,7 +346,9 @@ inline std::ostream& operator<<(std::ostream& os, const hiprtcResult& s) { } inline std::ostream& operator<<(std::ostream& os, const hipJitOption& s) { - switch (s) { + hiprtcJIT_option option = (hiprtcJIT_option)((int)s); + + switch (option) { case HIPRTC_JIT_MAX_REGISTERS: os << "HIPRTC_JIT_MAX_REGISTERS"; break; diff --git a/hipamd/src/hip_graph.cpp b/hipamd/src/hip_graph.cpp index 8342df7642..d1f490afe1 100644 --- a/hipamd/src/hip_graph.cpp +++ b/hipamd/src/hip_graph.cpp @@ -2295,21 +2295,19 @@ hipError_t hipGraphExecUpdate(hipGraphExec_t hGraphExec, hipGraph_t hGraph, } } - switch(newGraphNodes[i]->GetType()) { - case hipGraphNodeTypeMemcpy: { - // Checks if the memcpy node's parameters are same - const hip::GraphMemcpyNode* newMemcpyNode = - static_cast(newGraphNodes[i]); - const hip::GraphMemcpyNode* oldMemcpyNode = - static_cast(oldGraphExecNodes[i]); - hipMemcpyKind newKind, oldKind; - newKind = newMemcpyNode->GetMemcpyKind(); - oldKind = oldMemcpyNode->GetMemcpyKind(); - if (newKind != oldKind) { - *hErrorNode_out = reinterpret_cast(newGraphNodes[i]); - *updateResult_out = hipGraphExecUpdateErrorParametersChanged; - HIP_RETURN(hipErrorGraphExecUpdateFailure); - } + if (newGraphNodes[i]->GetType() == hipGraphNodeTypeMemcpy) { + // Checks if the memcpy node's parameters are same + const hip::GraphMemcpyNode* newMemcpyNode = + static_cast(newGraphNodes[i]); + const hip::GraphMemcpyNode* oldMemcpyNode = + static_cast(oldGraphExecNodes[i]); + hipMemcpyKind newKind, oldKind; + newKind = newMemcpyNode->GetMemcpyKind(); + oldKind = oldMemcpyNode->GetMemcpyKind(); + if (newKind != oldKind) { + *hErrorNode_out = reinterpret_cast(newGraphNodes[i]); + *updateResult_out = hipGraphExecUpdateErrorParametersChanged; + HIP_RETURN(hipErrorGraphExecUpdateFailure); } } // Checks if all the node's dependencies are same diff --git a/hipamd/src/hip_graph_internal.hpp b/hipamd/src/hip_graph_internal.hpp index 2229b75d8c..3679f93942 100644 --- a/hipamd/src/hip_graph_internal.hpp +++ b/hipamd/src/hip_graph_internal.hpp @@ -364,7 +364,9 @@ struct GraphNode : public hipGraphNodeDOTAttribute { fout << "\"" << fromNodeName << "\" -> \"" << toNodeName << "\"" << std::endl; } } - virtual std::string GetLabel(hipGraphDebugDotFlags flag) { return (std::to_string(id_) + "\n" + label_); } + virtual std::string GetLabel(hipGraphDebugDotFlags flag) override { + return (std::to_string(id_) + "\n" + label_); + } unsigned int GetEnabled() const { return isEnabled_; } void SetEnabled(unsigned int isEnabled) { isEnabled_ = isEnabled; } }; @@ -669,13 +671,13 @@ struct ChildGraphNode : public GraphNode { childGraph_ = rhs.childGraph_->clone(); } - GraphNode* clone() const { + GraphNode* clone() const override { return new ChildGraphNode(static_cast(*this)); } - Graph* GetChildGraph() { return childGraph_; } + Graph* GetChildGraph() override { return childGraph_; } - hipError_t GetNumParallelStreams(size_t &num) { + hipError_t GetNumParallelStreams(size_t &num) override { if (false == TopologicalOrder(childGraphNodeOrder_)) { return hipErrorInvalidValue; } @@ -690,17 +692,19 @@ struct ChildGraphNode : public GraphNode { return hipSuccess; } - void SetStream(hip::Stream* stream, GraphExec* ptr = nullptr) { + void SetStream(hip::Stream* stream, GraphExec* ptr = nullptr) override { stream_ = stream; UpdateStream(parallelLists_, stream, ptr); } // For nodes that are dependent on the child graph node waitlist is the last node of the first // parallel list - std::vector& GetCommands() { return parallelLists_[0].back()->GetCommands(); } + std::vector& GetCommands() override { + return parallelLists_[0].back()->GetCommands(); + } // Create child graph node commands and set waitlists - hipError_t CreateCommand(hip::Stream* stream) { + hipError_t CreateCommand(hip::Stream* stream) override { hipError_t status = GraphNode::CreateCommand(stream); if (status != hipSuccess) { return status; @@ -713,20 +717,20 @@ struct ChildGraphNode : public GraphNode { } // - void UpdateEventWaitLists(amd::Command::EventWaitList waitList) { + void UpdateEventWaitLists(amd::Command::EventWaitList waitList) override { if (startCommand_ != nullptr) { startCommand_->updateEventWaitList(waitList); } } void GetRunList(std::vector>& parallelList, - std::unordered_map>& dependencies) { + std::unordered_map>& dependencies) override { childGraph_->GetRunList(parallelLists_, nodeWaitLists_); } - bool TopologicalOrder(std::vector& TopoOrder) { + bool TopologicalOrder(std::vector& TopoOrder) override { return childGraph_->TopologicalOrder(TopoOrder); } - void EnqueueCommands(hipStream_t stream) { + void EnqueueCommands(hipStream_t stream) override { // enqueue child graph start command if (startCommand_ != nullptr) { startCommand_->enqueue(); @@ -755,16 +759,16 @@ struct ChildGraphNode : public GraphNode { return hipSuccess; } - hipError_t SetParams(GraphNode* node) { + hipError_t SetParams(GraphNode* node) override { const ChildGraphNode* childGraphNode = static_cast(node); return SetParams(childGraphNode->childGraph_); } - std::string GetLabel(hipGraphDebugDotFlags flag) { + virtual std::string GetLabel(hipGraphDebugDotFlags flag) override { return std::to_string(GetID()) + "\n" + "graph_" + std::to_string(childGraph_->GetID()); } - virtual void GenerateDOT(std::ostream& fout, hipGraphDebugDotFlags flag) { + virtual void GenerateDOT(std::ostream& fout, hipGraphDebugDotFlags flag) override { childGraph_->GenerateDOT(fout, flag); } }; @@ -783,7 +787,7 @@ class GraphKernelNode : public GraphNode { size_t GetKerArgSize() const { return alignedKernArgSize_; } size_t GetKernargSegmentByteSize() const { return kernargSegmentByteSize_; } size_t GetKernargSegmentAlignment() const { return kernargSegmentAlignment_; } - void PrintAttributes(std::ostream& out, hipGraphDebugDotFlags flag) { + void PrintAttributes(std::ostream& out, hipGraphDebugDotFlags flag) override { out << "["; out << "style"; out << "=\""; @@ -817,7 +821,7 @@ class GraphKernelNode : public GraphNode { } } - std::string GetLabel(hipGraphDebugDotFlags flag) { + virtual std::string GetLabel(hipGraphDebugDotFlags flag) override { hipFunction_t func = getFunc(kernelParams_, ihipGetDevice()); hip::DeviceFunc* function = hip::DeviceFunc::asFunction(func); std::string label; @@ -865,7 +869,7 @@ class GraphKernelNode : public GraphNode { return label; } - std::string GetShape(hipGraphDebugDotFlags flag) { + std::string GetShape(hipGraphDebugDotFlags flag) override { if (flag == hipGraphDebugDotFlagsKernelNodeParams || flag == hipGraphDebugDotFlagsVerbose) { return "record"; } else { @@ -1003,11 +1007,11 @@ class GraphKernelNode : public GraphNode { } } - GraphNode* clone() const { + GraphNode* clone() const override { return new GraphKernelNode(static_cast(*this)); } - hipError_t CreateCommand(hip::Stream* stream) { + hipError_t CreateCommand(hip::Stream* stream) override { hipFunction_t func = nullptr; hipError_t status = validateKernelParams(&kernelParams_, &func, stream ? hip::getDeviceID(stream->context()) : -1); @@ -1136,7 +1140,7 @@ class GraphKernelNode : public GraphNode { return hipSuccess; } - hipError_t SetParams(GraphNode* node) { + hipError_t SetParams(GraphNode* node) override { const GraphKernelNode* kernelNode = static_cast(node); return SetParams(&kernelNode->kernelParams_); } @@ -1184,11 +1188,11 @@ class GraphMemcpyNode : public GraphNode { copyParams_ = rhs.copyParams_; } - GraphNode* clone() const { + GraphNode* clone() const override { return new GraphMemcpyNode(static_cast(*this)); } - virtual hipError_t CreateCommand(hip::Stream* stream) { + virtual hipError_t CreateCommand(hip::Stream* stream) override { if ((copyParams_.kind == hipMemcpyHostToHost || copyParams_.kind == hipMemcpyDefault) && IsHtoHMemcpy(copyParams_.dstPtr.ptr, copyParams_.srcPtr.ptr)) { return hipSuccess; @@ -1230,14 +1234,14 @@ class GraphMemcpyNode : public GraphNode { return hipSuccess; } - virtual hipError_t SetParams(GraphNode* node) { + virtual hipError_t SetParams(GraphNode* node) override { const GraphMemcpyNode* memcpyNode = static_cast(node); return SetParams(&memcpyNode->copyParams_); } // ToDo: use this when commands are cloned and command params are to be updated hipError_t ValidateParams(const hipMemcpy3DParms* pNodeParams); - std::string GetLabel(hipGraphDebugDotFlags flag) { + virtual std::string GetLabel(hipGraphDebugDotFlags flag) override { size_t offset = 0; const HIP_MEMCPY3D pCopy = hip::getDrvMemcpy3DDesc(copyParams_); hipMemoryType srcMemoryType = pCopy.srcMemoryType; @@ -1312,7 +1316,7 @@ class GraphMemcpyNode : public GraphNode { } return label; } - std::string GetShape(hipGraphDebugDotFlags flag) { + std::string GetShape(hipGraphDebugDotFlags flag) override { if (flag == hipGraphDebugDotFlagsMemcpyNodeParams || flag == hipGraphDebugDotFlagsVerbose) { return "record"; } else { @@ -1339,11 +1343,11 @@ class GraphMemcpyNode1D : public GraphMemcpyNode { ~GraphMemcpyNode1D() {} - GraphNode* clone() const { + GraphNode* clone() const override { return new GraphMemcpyNode1D(static_cast(*this)); } - virtual hipError_t CreateCommand(hip::Stream* stream) { + virtual hipError_t CreateCommand(hip::Stream* stream) override { if ((kind_ == hipMemcpyHostToHost || kind_ == hipMemcpyDefault) && IsHtoHMemcpy(dst_, src_)) { return hipSuccess; } @@ -1358,7 +1362,7 @@ class GraphMemcpyNode1D : public GraphMemcpyNode { return status; } - virtual void EnqueueCommands(hipStream_t stream) { + virtual void EnqueueCommands(hipStream_t stream) override { bool isH2H = false; if ((kind_ == hipMemcpyHostToHost || kind_ == hipMemcpyDefault) && IsHtoHMemcpy(dst_, src_)) { isH2H = true; @@ -1419,7 +1423,7 @@ class GraphMemcpyNode1D : public GraphMemcpyNode { } } - hipMemcpyKind GetMemcpyKind() const { + hipMemcpyKind GetMemcpyKind() const override { return kind_; } @@ -1435,13 +1439,13 @@ class GraphMemcpyNode1D : public GraphMemcpyNode { return hipSuccess; } - virtual hipError_t SetParams(GraphNode* node) { + virtual hipError_t SetParams(GraphNode* node) override { const GraphMemcpyNode1D* memcpy1DNode = static_cast(node); return SetParams(memcpy1DNode->dst_, memcpy1DNode->src_, memcpy1DNode->count_, memcpy1DNode->kind_); } static hipError_t ValidateParams(void* dst, const void* src, size_t count, hipMemcpyKind kind); - std::string GetLabel(hipGraphDebugDotFlags flag) { + virtual std::string GetLabel(hipGraphDebugDotFlags flag) override { size_t sOffsetOrig = 0; amd::Memory* origSrcMemory = getMemoryObject(src_, sOffsetOrig); size_t dOffsetOrig = 0; @@ -1468,16 +1472,18 @@ class GraphMemcpyNode1D : public GraphMemcpyNode { std::string label; if (flag == hipGraphDebugDotFlagsMemcpyNodeParams || flag == hipGraphDebugDotFlagsVerbose) { char buffer[500]; - sprintf(buffer, - "{\n%s\n| {{ID | node handle} | {%u | %p}}\n| {kind | %s}\n| {{srcPtr | dstPtr} | " - "{pitch " - "| ptr | xsize | ysize | pitch | ptr | xsize | size} | {%zu | %p | %zu | %zu | %zu | %p " - "| %zu " - "| %zu}}\n| {{srcPos | {{x | %zu} | {y | %zu} | {z | %zu}}} | {dstPos | {{x | %zu} | {y " - "| " - "%zu} | {z | %zu}}} | {Extent | {{Width | %zu} | {Height | %zu} | {Depth | %zu}}}}\n}", - label_.c_str(), GetID(), this, memcpyDirection.c_str(), (size_t)0, - src_, (size_t)0, (size_t)0, (size_t)0, dst_, (size_t)0, (size_t)0, (size_t)0, (size_t)0, (size_t)0, (size_t)0, (size_t)0, (size_t)0, count_, (size_t)1, (size_t)1); + sprintf( + buffer, + "{\n%s\n| {{ID | node handle} | {%u | %p}}\n| {kind | %s}\n| {{srcPtr | dstPtr} | " + "{pitch " + "| ptr | xsize | ysize | pitch | ptr | xsize | size} | {%zu | %p | %zu | %zu | %zu | %p " + "| %zu " + "| %zu}}\n| {{srcPos | {{x | %zu} | {y | %zu} | {z | %zu}}} | {dstPos | {{x | %zu} | {y " + "| " + "%zu} | {z | %zu}}} | {Extent | {{Width | %zu} | {Height | %zu} | {Depth | %zu}}}}\n}", + label_.c_str(), GetID(), this, memcpyDirection.c_str(), (size_t)0, src_, (size_t)0, + (size_t)0, (size_t)0, dst_, (size_t)0, (size_t)0, (size_t)0, (size_t)0, (size_t)0, + (size_t)0, (size_t)0, (size_t)0, count_, (size_t)1, (size_t)1); label = buffer; } else { label = std::to_string(GetID()) + "\n" + label_ + "\n(" + memcpyDirection + "," + @@ -1485,7 +1491,7 @@ class GraphMemcpyNode1D : public GraphMemcpyNode { } return label; } - std::string GetShape(hipGraphDebugDotFlags flag) { + std::string GetShape(hipGraphDebugDotFlags flag) override { if (flag == hipGraphDebugDotFlagsMemcpyNodeParams || flag == hipGraphDebugDotFlagsVerbose) { return "record"; } else { @@ -1507,12 +1513,12 @@ class GraphMemcpyNodeFromSymbol : public GraphMemcpyNode1D { ~GraphMemcpyNodeFromSymbol() {} - GraphNode* clone() const { + GraphNode* clone() const override { return new GraphMemcpyNodeFromSymbol( static_cast(*this)); } - virtual hipError_t CreateCommand(hip::Stream* stream) { + virtual hipError_t CreateCommand(hip::Stream* stream) override { hipError_t status = GraphNode::CreateCommand(stream); if (status != hipSuccess) { return status; @@ -1580,7 +1586,7 @@ class GraphMemcpyNodeFromSymbol : public GraphMemcpyNode1D { return hipSuccess; } - virtual hipError_t SetParams(GraphNode* node) { + virtual hipError_t SetParams(GraphNode* node) override { const GraphMemcpyNodeFromSymbol* memcpyNode = static_cast(node); return SetParams(memcpyNode->dst_, memcpyNode->symbol_, memcpyNode->count_, memcpyNode->offset_, @@ -1600,11 +1606,11 @@ class GraphMemcpyNodeToSymbol : public GraphMemcpyNode1D { ~GraphMemcpyNodeToSymbol() {} - GraphNode* clone() const { + GraphNode* clone() const override { return new GraphMemcpyNodeToSymbol(static_cast(*this)); } - virtual hipError_t CreateCommand(hip::Stream* stream) { + virtual hipError_t CreateCommand(hip::Stream* stream) override { hipError_t status = GraphNode::CreateCommand(stream); if (status != hipSuccess) { return status; @@ -1670,7 +1676,7 @@ class GraphMemcpyNodeToSymbol : public GraphMemcpyNode1D { return hipSuccess; } - virtual hipError_t SetParams(GraphNode* node) { + virtual hipError_t SetParams(GraphNode* node) override { const GraphMemcpyNodeToSymbol* memcpyNode = static_cast(node); return SetParams(memcpyNode->src_, memcpyNode->symbol_, memcpyNode->count_, memcpyNode->offset_, @@ -1698,11 +1704,11 @@ class GraphMemsetNode : public GraphNode { memsetParams_ = memsetNode.memsetParams_; } - GraphNode* clone() const { + GraphNode* clone() const override { return new GraphMemsetNode(static_cast(*this)); } - std::string GetLabel(hipGraphDebugDotFlags flag) { + virtual std::string GetLabel(hipGraphDebugDotFlags flag) override { std::string label; if (flag == hipGraphDebugDotFlagsMemsetNodeParams || flag == hipGraphDebugDotFlagsVerbose) { char buffer[500]; @@ -1726,7 +1732,7 @@ class GraphMemsetNode : public GraphNode { return label; } - std::string GetShape(hipGraphDebugDotFlags flag) { + std::string GetShape(hipGraphDebugDotFlags flag) override { if (flag == hipGraphDebugDotFlagsMemsetNodeParams || flag == hipGraphDebugDotFlagsVerbose) { return "record"; } else { @@ -1734,7 +1740,7 @@ class GraphMemsetNode : public GraphNode { } } - hipError_t CreateCommand(hip::Stream* stream) { + hipError_t CreateCommand(hip::Stream* stream) override { hipError_t status = GraphNode::CreateCommand(stream); if (status != hipSuccess) { return status; @@ -1748,7 +1754,9 @@ class GraphMemsetNode : public GraphNode { commands_, {memsetParams_.dst, memsetParams_.pitch, memsetParams_.width * memsetParams_.elementSize, memsetParams_.height}, - memsetParams_.value, {memsetParams_.width * memsetParams_.elementSize, memsetParams_.height, 1}, stream, memsetParams_.elementSize); + memsetParams_.value, + {memsetParams_.width * memsetParams_.elementSize, memsetParams_.height, 1}, stream, + memsetParams_.elementSize); } return status; } @@ -1818,9 +1826,9 @@ class GraphMemsetNode : public GraphNode { } } sizeBytes = params->width * params->elementSize * params->height * 1; - hip_error = - ihipMemset3D_validate({params->dst, params->pitch, params->width * params->elementSize, params->height}, - params->value, {params->width * params->elementSize, params->height, 1}, sizeBytes); + hip_error = ihipMemset3D_validate( + {params->dst, params->pitch, params->width * params->elementSize, params->height}, + params->value, {params->width * params->elementSize, params->height, 1}, sizeBytes); } if (hip_error != hipSuccess) { return hip_error; @@ -1841,7 +1849,7 @@ class GraphMemsetNode : public GraphNode { pmemsetParams.width = params->width; return SetParamsInternal(&pmemsetParams, isExec); } - hipError_t SetParams(GraphNode* node) { + hipError_t SetParams(GraphNode* node) override { const GraphMemsetNode* memsetNode = static_cast(node); return SetParams(&memsetNode->memsetParams_); } @@ -1856,11 +1864,11 @@ class GraphEventRecordNode : public GraphNode { event_(event) {} ~GraphEventRecordNode() {} - GraphNode* clone() const { + GraphNode* clone() const override { return new GraphEventRecordNode(static_cast(*this)); } - hipError_t CreateCommand(hip::Stream* stream) { + hipError_t CreateCommand(hip::Stream* stream) override { hipError_t status = GraphNode::CreateCommand(stream); if (status != hipSuccess) { return status; @@ -1873,7 +1881,7 @@ class GraphEventRecordNode : public GraphNode { return status; } - void EnqueueCommands(hipStream_t stream) { + void EnqueueCommands(hipStream_t stream) override { if (!commands_.empty()) { hip::Event* e = reinterpret_cast(event_); // command release during enqueueRecordCommand @@ -1893,7 +1901,7 @@ class GraphEventRecordNode : public GraphNode { return hipSuccess; } - hipError_t SetParams(GraphNode* node) { + hipError_t SetParams(GraphNode* node) override { const GraphEventRecordNode* eventRecordNode = static_cast(node); return SetParams(eventRecordNode->event_); @@ -1909,11 +1917,11 @@ class GraphEventWaitNode : public GraphNode { event_(event) {} ~GraphEventWaitNode() {} - GraphNode* clone() const { + GraphNode* clone() const override { return new GraphEventWaitNode(static_cast(*this)); } - hipError_t CreateCommand(hip::Stream* stream) { + hipError_t CreateCommand(hip::Stream* stream) override { hipError_t status = GraphNode::CreateCommand(stream); if (status != hipSuccess) { return status; @@ -1926,7 +1934,7 @@ class GraphEventWaitNode : public GraphNode { return status; } - void EnqueueCommands(hipStream_t stream) { + void EnqueueCommands(hipStream_t stream) override { if (!commands_.empty()) { hip::Event* e = reinterpret_cast(event_); hipError_t status = e->enqueueStreamWaitCommand(stream, commands_[0]); @@ -1946,7 +1954,7 @@ class GraphEventWaitNode : public GraphNode { return hipSuccess; } - hipError_t SetParams(GraphNode* node) { + hipError_t SetParams(GraphNode* node) override { const GraphEventWaitNode* eventWaitNode = static_cast(node); return SetParams(eventWaitNode->event_); } @@ -1966,11 +1974,11 @@ class GraphHostNode : public GraphNode { NodeParams_ = hostNode.NodeParams_; } - GraphNode* clone() const { + GraphNode* clone() const override { return new GraphHostNode(static_cast(*this)); } - hipError_t CreateCommand(hip::Stream* stream) { + hipError_t CreateCommand(hip::Stream* stream) override { hipError_t status = GraphNode::CreateCommand(stream); if (status != hipSuccess) { return status; @@ -1987,7 +1995,7 @@ class GraphHostNode : public GraphNode { NodeParams->fn(NodeParams->userData); } - void EnqueueCommands(hipStream_t stream) { + void EnqueueCommands(hipStream_t stream) override { if (!commands_.empty()) { if (!commands_[0]->setCallback(CL_COMPLETE, GraphHostNode::Callback, &NodeParams_)) { ClPrint(amd::LOG_ERROR, amd::LOG_CODE, "[hipGraph] Failed during setCallback"); @@ -2015,7 +2023,7 @@ class GraphHostNode : public GraphNode { return hipSuccess; } - hipError_t SetParams(GraphNode* node) { + hipError_t SetParams(GraphNode* node) override { const GraphHostNode* hostNode = static_cast(node); return SetParams(&hostNode->NodeParams_); } @@ -2026,11 +2034,11 @@ class GraphEmptyNode : public GraphNode { GraphEmptyNode() : GraphNode(hipGraphNodeTypeEmpty, "solid", "rectangle", "EMPTY") {} ~GraphEmptyNode() {} - GraphNode* clone() const { + GraphNode* clone() const override { return new GraphEmptyNode(static_cast(*this)); } - hipError_t CreateCommand(hip::Stream* stream) { + hipError_t CreateCommand(hip::Stream* stream) override { hipError_t status = GraphNode::CreateCommand(stream); if (status != hipSuccess) { return status; @@ -2044,8 +2052,8 @@ class GraphEmptyNode : public GraphNode { }; // ================================================================================================ -class GraphMemAllocNode : public GraphNode { - hipMemAllocNodeParams node_params_; // Node parameters for memory allocation +class GraphMemAllocNode final : public GraphNode { + hipMemAllocNodeParams node_params_; // Node parameters for memory allocation amd::Memory* va_ = nullptr; // Memory object, which holds a virtual address // Derive the new class for VirtualMapCommand, @@ -2289,11 +2297,11 @@ class GraphDrvMemcpyNode : public GraphNode { copyParams_ = rhs.copyParams_; } - GraphNode* clone() const { + GraphNode* clone() const override { return new GraphDrvMemcpyNode(static_cast(*this)); } - hipError_t CreateCommand(hip::Stream* stream) { + hipError_t CreateCommand(hip::Stream* stream) override { if(copyParams_.srcMemoryType == hipMemoryTypeHost && copyParams_.dstMemoryType == hipMemoryTypeHost && IsHtoHMemcpy(copyParams_.dstHost, copyParams_.srcHost)) { @@ -2337,7 +2345,7 @@ class GraphDrvMemcpyNode : public GraphNode { std::memcpy(©Params_, params, sizeof(HIP_MEMCPY3D)); return hipSuccess; } - hipError_t SetParams(GraphNode* node) { + hipError_t SetParams(GraphNode* node) override { const GraphDrvMemcpyNode* memcpyNode = static_cast(node); return SetParams(&memcpyNode->copyParams_); } diff --git a/hipamd/src/hip_hmm.cpp b/hipamd/src/hip_hmm.cpp index 57270d942c..908e030d87 100644 --- a/hipamd/src/hip_hmm.cpp +++ b/hipamd/src/hip_hmm.cpp @@ -232,7 +232,7 @@ hipError_t hipStreamAttachMemAsync(hipStream_t stream, void* dev_ptr, size_t length, unsigned int flags) { HIP_INIT_API(hipStreamAttachMemAsync, stream, dev_ptr, length, flags); // stream can be null, length can be 0. - if ((dev_ptr == nullptr)) { + if (dev_ptr == nullptr) { HIP_RETURN(hipErrorInvalidValue); } diff --git a/hipamd/src/hip_module.cpp b/hipamd/src/hip_module.cpp index 2bd64fbd98..c1bf8523db 100644 --- a/hipamd/src/hip_module.cpp +++ b/hipamd/src/hip_module.cpp @@ -115,7 +115,7 @@ hipError_t hipModuleGetGlobal(hipDeviceptr_t* dptr, size_t* bytes, hipModule_t h hipError_t hipFuncGetAttribute(int* value, hipFunction_attribute attrib, hipFunction_t hfunc) { HIP_INIT_API(hipFuncGetAttribute, value, attrib, hfunc); - if ((value == nullptr)) { + if (value == nullptr) { HIP_RETURN(hipErrorInvalidValue); } diff --git a/hipamd/src/hip_table_interface.cpp b/hipamd/src/hip_table_interface.cpp index 84d714dbe1..f711050de9 100644 --- a/hipamd/src/hip_table_interface.cpp +++ b/hipamd/src/hip_table_interface.cpp @@ -131,10 +131,12 @@ hipError_t hipCreateTextureObject(hipTextureObject_t* pTexObject, const hipResou return hip::GetHipDispatchTable()->hipCreateTextureObject_fn(pTexObject, pResDesc, pTexDesc, pResViewDesc); } -hipError_t hipCtxCreate(hipCtx_t* ctx, unsigned int flags, hipDevice_t device) { +extern "C" hipError_t hipCtxCreate(hipCtx_t* ctx, unsigned int flags, hipDevice_t device) { return hip::GetHipDispatchTable()->hipCtxCreate_fn(ctx, flags, device); } -hipError_t hipCtxDestroy(hipCtx_t ctx) { return hip::GetHipDispatchTable()->hipCtxDestroy_fn(ctx); } +extern "C" hipError_t hipCtxDestroy(hipCtx_t ctx) { + return hip::GetHipDispatchTable()->hipCtxDestroy_fn(ctx); +} hipError_t hipCtxDisablePeerAccess(hipCtx_t peerCtx) { return hip::GetHipDispatchTable()->hipCtxDisablePeerAccess_fn(peerCtx); }