CM EMU: multithread runtime and barriers implementation: initial contribution.

Issue: VMIT-6799
Resolves: VMIT-6799
Co-Authored-By: Satanovskiy Leonid <leonid.satanovkiy@intel.com>
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
diff --git a/cmrtlib/agnostic/hardware/cm_queue.cpp b/cmrtlib/agnostic/hardware/cm_queue.cpp
index 043485d..9367fa1 100644
--- a/cmrtlib/agnostic/hardware/cm_queue.cpp
+++ b/cmrtlib/agnostic/hardware/cm_queue.cpp
@@ -855,3 +855,8 @@
     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 067ca81..49ee6c4 100644
--- a/cmrtlib/agnostic/hardware/cm_queue.h
+++ b/cmrtlib/agnostic/hardware/cm_queue.h
@@ -154,6 +154,8 @@
                               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 c7fe9a7..9d1be26 100644
--- a/cmrtlib/agnostic/share/cm_queue_base.h
+++ b/cmrtlib/agnostic/share/cm_queue_base.h
@@ -526,6 +526,18 @@
                                   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 e195e2d..79dddad 100644
--- a/cmrtlib/agnostic/share/cm_rt.h
+++ b/cmrtlib/agnostic/share/cm_rt.h
@@ -1503,6 +1503,8 @@
     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(){};
 };