]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - dense-linear-algebra-libraries/linalg.git/blobdiff - blis/frame/3/herk/bli_herk_u_ker_var2.c
Refactored BLIS code using LibArch API for memory transfers.
[dense-linear-algebra-libraries/linalg.git] / blis / frame / 3 / herk / bli_herk_u_ker_var2.c
index 1edb8183f4df98fe8bc2b5b49f5ebbc0893e1a54..04e1902eb56a005b61576b23e75ae637a2699824 100644 (file)
@@ -214,9 +214,9 @@ void PASTEMAC(ch,varname)( \
        ctype *cNew0, *cNew1, *cNew2, *cNewTemp; \
        /*EDMA Declarations */ \
 \
-       EdmaMgr_Handle edma_handle_b = NULL; \
-       EdmaMgr_Handle edma_handle_c0 = NULL; \
-       EdmaMgr_Handle edma_handle_c1 = NULL; \
+       lib_emt_Handle emt_handle_b = NULL; \
+       lib_emt_Handle emt_handle_c0 = NULL; \
+       lib_emt_Handle emt_handle_c1 = NULL; \
 \
        /*
           Assumptions/assertions:
@@ -326,21 +326,21 @@ void PASTEMAC(ch,varname)( \
        cNew2 = bli_mem_buffer( &c2_L2_mem ); \
 \
        /*Acquiring an EDMA  handle from the pool*/ \
-       bli_dma_channel_acquire(&(edma_handle_b), CSL_chipReadDNUM()); \
-       if(edma_handle_b == NULL) \
+       bli_dma_channel_acquire(&(emt_handle_b), lib_get_coreID()); \
+       if(emt_handle_b == NULL) \
        { \
-               printf("ker_var2 Failed to alloc edma handle CoreID %d \n", CSL_chipReadDNUM()); \
+               printf("ker_var2 Failed to alloc edma handle CoreID %d \n", lib_get_coreID()); \
        } \
-       bli_dma_channel_acquire(&(edma_handle_c0), CSL_chipReadDNUM()); \
-       if(edma_handle_c0 == NULL) \
+       bli_dma_channel_acquire(&(emt_handle_c0), lib_get_coreID()); \
+       if(emt_handle_c0 == NULL) \
        { \
-               printf("ker_var2 Failed to alloc edma handle for C0 CoreID %d \n", CSL_chipReadDNUM()); \
+               printf("ker_var2 Failed to alloc edma handle for C0 CoreID %d \n", lib_get_coreID()); \
        } \
        /*Acquiring an EDMA  handle from the pool*/ \
-       bli_dma_channel_acquire(&(edma_handle_c1), CSL_chipReadDNUM()); \
-       if(edma_handle_c1 == NULL) \
+       bli_dma_channel_acquire(&(emt_handle_c1), lib_get_coreID()); \
+       if(emt_handle_c1 == NULL) \
        { \
-               printf("ker_var2 Failed to alloc edma handle for C1 CoreID %d \n", CSL_chipReadDNUM()); \
+               printf("ker_var2 Failed to alloc edma handle for C1 CoreID %d \n", lib_get_coreID()); \
        } \
 \
        /* initiate first c transfer */ \
@@ -350,7 +350,7 @@ void PASTEMAC(ch,varname)( \
        n_cur = ( bli_is_not_edge_f( jr_thread_id, n_iter, n_left ) ? NR : n_left ); \
        if (cs_c*sizeof(ctype) < BLIS_C66X_MAXDMASTRIDE) \
        { \
-               EdmaMgr_copy2D2DSep(edma_handle_c0, c_cast+jr_thread_id*cstep_c, \
+               lib_emt_copy2D2D(emt_handle_c0, c_cast+jr_thread_id*cstep_c, \
                                                        cNew1, m*sizeof(ctype), \
                                                        n_cur, cs_c*sizeof(ctype), cs_c11*sizeof(ctype)); \
        }\
@@ -385,15 +385,15 @@ void PASTEMAC(ch,varname)( \
                /* Initialize our next panel of B to be the current panel of B. */ \
                b2 = b1; \
 \
-        EdmaMgr_copy1D1D(edma_handle_b, b1, b1_L1, k*NR*sizeof(ctype)); \
-        idma1_setup(a2_L1, a_cast + ir_thread_id * rstep_a, k*MR*sizeof(ctype), 0, 0, 7); \
+        lib_emt_copy1D1D(emt_handle_b, b1, b1_L1, k*NR*sizeof(ctype)); \
+        lib_imt_copy(a_cast + ir_thread_id * rstep_a, a2_L1, k*MR*sizeof(ctype)); \
         /* wait for previous c transfer to complete and initiate next transfer */ \
-        EdmaMgr_wait(edma_handle_c0); \
+        lib_emt_wait(emt_handle_c0); \
         if(j < (n_iter-jr_num_threads)) /* no transfer for last iteration */ \
         { \
                if (cs_c*sizeof(ctype) < BLIS_C66X_MAXDMASTRIDE) \
                { \
-                       EdmaMgr_copy2D2DSep(edma_handle_c0, c1+jr_num_threads*cstep_c, \
+                       lib_emt_copy2D2D(emt_handle_c0, c1+jr_num_threads*cstep_c, \
                                                                cNew0, m*sizeof(ctype), /*(m_iter-ir_thread_id)*sizeof(ctype)*MR,*/ \
                                        n_next, cs_c*sizeof(ctype), \
                                        cs_c11*sizeof(ctype)); \
@@ -433,7 +433,7 @@ void PASTEMAC(ch,varname)( \
                        a1_L1 = a2_L1; \
                        a2_L1 = temp; \
                        /*a1 = a2; Make the next panel the current panel for the next iteration*/ \
-                       while(!idma1_done()){;} \
+                       lib_imt_wait(); \
                        if ( bli_is_last_iter( i, m_iter, ir_thread_id, ir_num_threads ) ) \
                        { \
                                a2 = a_cast; \
@@ -444,11 +444,11 @@ void PASTEMAC(ch,varname)( \
                        else \
                        {\
                                /*Start next panel*/ \
-                               idma1_setup(a2_L1, a2, k*MR*sizeof(ctype), 0, 0, 7); \
+                               lib_imt_copy(a2, a2_L1, k*MR*sizeof(ctype)); \
                        }\
                        if(i == ir_thread_id) \
                        { \
-                               EdmaMgr_wait(edma_handle_b);\
+                               lib_emt_wait(emt_handle_b);\
                        } \
 \
                        /* Save addresses of next panels of A and B to the auxinfo_t
@@ -521,12 +521,12 @@ void PASTEMAC(ch,varname)( \
                cNew1 = cNewTemp; \
                if(j != jr_thread_id) /* wait for save c to complete; skip first iteration */ \
                { \
-                   EdmaMgr_wait(edma_handle_c1); \
+                   lib_emt_wait(emt_handle_c1); \
         } \
                /* save updated c */ \
                if (cs_c*sizeof(ctype) < BLIS_C66X_MAXDMASTRIDE) \
                { \
-                       EdmaMgr_copy2D2DSep(edma_handle_c1, cNew2, c1, m*sizeof(ctype), \
+                       lib_emt_copy2D2D(emt_handle_c1, cNew2, c1, m*sizeof(ctype), \
                                                                n_cur, cs_c11*sizeof(ctype), cs_c*sizeof(ctype)); \
                } \
         else \
@@ -551,21 +551,21 @@ void PASTEMAC(ch,varname)( \
        bli_mem_release( &a2_L1_mem ); \
        bli_mem_release( &a1_L1_mem ); \
        bli_mem_release( &b1_L1_mem ); \
-       if ( edma_handle_b != NULL ) \
+       if ( emt_handle_b != NULL ) \
     { \
-               bli_dma_channel_release(edma_handle_b, CSL_chipReadDNUM()); \
-               edma_handle_b = NULL; \
+               bli_dma_channel_release(emt_handle_b, lib_get_coreID()); \
+               emt_handle_b = NULL; \
     } \
-    if ( edma_handle_c0 != NULL ) \
+    if ( emt_handle_c0 != NULL ) \
     { \
-        bli_dma_channel_release(edma_handle_c0, CSL_chipReadDNUM()); \
-        edma_handle_c0 = NULL; \
+        bli_dma_channel_release(emt_handle_c0, lib_get_coreID()); \
+        emt_handle_c0 = NULL; \
     } \
-    if ( edma_handle_c1 != NULL ) \
+    if ( emt_handle_c1 != NULL ) \
     { \
-        EdmaMgr_wait(edma_handle_c1); /* wait for save c to complete */ \
-        bli_dma_channel_release(edma_handle_c1, CSL_chipReadDNUM()); \
-        edma_handle_c1 = NULL; \
+        lib_emt_wait(emt_handle_c1); /* wait for save c to complete */ \
+        bli_dma_channel_release(emt_handle_c1, lib_get_coreID()); \
+        emt_handle_c1 = NULL; \
     } \
 }