From 0e55ffe7e156cce5afeebb62d96e40f2d8115f50 Mon Sep 17 00:00:00 2001 From: Wu_Chengxi Date: Thu, 17 Oct 2019 22:50:47 +0800 Subject: [PATCH] CM EMU: multithread runtime and barriers implementation: initial contribution. Issue: VMIT-6799 Resolves: VMIT-6799 Co-Authored-By: Satanovskiy Leonid for - Build fixes (work under 3Dbuilder and local script + 32bits build fixed) - Workable 32bits mode, generalized kernel launcher to reuse in single thread mode. - Misc fixes. Change-Id: I7d3638f38e22e2a0b0f7d389aa9e5fc045c67b17 --- cmrtlib/agnostic/hardware/cm_queue.cpp | 5 +++++ cmrtlib/agnostic/hardware/cm_queue.h | 2 ++ cmrtlib/agnostic/share/cm_queue_base.h | 12 ++++++++++++ cmrtlib/agnostic/share/cm_rt.h | 2 ++ 4 files changed, 21 insertions(+) diff --git a/cmrtlib/agnostic/hardware/cm_queue.cpp b/cmrtlib/agnostic/hardware/cm_queue.cpp index 043485dbfb2..9367fa1297e 100644 --- a/cmrtlib/agnostic/hardware/cm_queue.cpp +++ b/cmrtlib/agnostic/hardware/cm_queue.cpp @@ -855,3 +855,8 @@ CM_RT_API int32_t CmQueue_RT::DestroyEventFast(CmEvent *&event) return CM_SUCCESS; } +CM_RT_API int32_t CmQueue_RT::SetResidentGroupAndParallelThreadNum(uint32_t residentGroupNum, uint32_t parallelThreadNum) +{ + return CM_NOT_IMPLEMENTED; +} + diff --git a/cmrtlib/agnostic/hardware/cm_queue.h b/cmrtlib/agnostic/hardware/cm_queue.h index 067ca81a6ba..49ee6c4faa0 100644 --- a/cmrtlib/agnostic/hardware/cm_queue.h +++ b/cmrtlib/agnostic/hardware/cm_queue.h @@ -154,6 +154,8 @@ class CmQueue_RT : public CmQueue CmEvent *&event, const CmThreadGroupSpace *threadGroupSpace = nullptr); + CM_RT_API int32_t SetResidentGroupAndParallelThreadNum(uint32_t residentGroupNum, uint32_t parallelThreadNum); + CM_QUEUE_CREATE_OPTION GetQueueOption(); protected: diff --git a/cmrtlib/agnostic/share/cm_queue_base.h b/cmrtlib/agnostic/share/cm_queue_base.h index c7fe9a7eecb..9d1be266c55 100644 --- a/cmrtlib/agnostic/share/cm_queue_base.h +++ b/cmrtlib/agnostic/share/cm_queue_base.h @@ -526,6 +526,18 @@ class CmQueue CmEvent *&event, const CmThreadGroupSpace *threadGroupSpace = nullptr) = 0; + //! + //! \brief [Only In Emu Mode] set the resident group number and parallel thread number + //! \details + //! \param [in] residentGroupNum + //! number of resident groups running on device + //! \param [in] parallelThreadNum + //! number of threads run in parallel + //! \retval CM_SUCCESS if the parameter is successfully set. + //! \retval CM_NOT_IMPLEMENTED if in sim or emu mode + //! + CM_RT_API virtual int32_t SetResidentGroupAndParallelThreadNum(uint32_t residentGroupNum, uint32_t parallelThreadNum) = 0; + protected: virtual ~CmQueue() = default; }; diff --git a/cmrtlib/agnostic/share/cm_rt.h b/cmrtlib/agnostic/share/cm_rt.h index e195e2d9f2d..79dddadecc9 100644 --- a/cmrtlib/agnostic/share/cm_rt.h +++ b/cmrtlib/agnostic/share/cm_rt.h @@ -1503,6 +1503,8 @@ class CmQueue CM_RT_API virtual INT EnqueueWithGroupFast(CmTask *task, CmEvent *&event, const CmThreadGroupSpace *threadGroupSpace = nullptr) = 0; + + CM_RT_API virtual INT SetResidentGroupAndParallelThreadNum(uint32_t residentGroupNum, uint32_t parallelThreadNum) = 0; protected: ~CmQueue(){}; };