Skip to content

Commit 831b822

Browse files
committed
Fix incorrect inline assembly constraints in dcbt prefetch instructions
Corrected the register constraints for the PowerPC dcbt (Data Cache Block Touch) instruction in Power10 kernel implementations. The dcbt instruction has special behavior where if the first operand (RA) is r0, it uses the value 0 instead of the register contents. Therefore, RA must use the "b" constraint (any GPR except r0), while RB can use "r" (any GPR including r0). Changes: - Changed first operand constraint from "r" to "b" to exclude r0 - Changed second operand constraint from "b" to "r" for flexibility This ensures correct prefetch behavior and compliance with PowerPC ISA specifications, preventing potential issues where r0 might be incorrectly used as the base address register. Signed-off-by: Amrita H S <amritahs@linux.vnet.ibm.com>
1 parent 91f97c6 commit 831b822

6 files changed

Lines changed: 6 additions & 6 deletions

File tree

kernel/power/cgemm_kernel_power10.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ typedef FLOAT v2sf_t __attribute__ ((vector_size (8)));
452452
CO[6*ldc+0] A_OP tr[3] * alpha_r - ti[3] * alpha_i; \
453453
CO[6*ldc+1] A_OP ti[3] * alpha_r + tr[3] * alpha_i;
454454

455-
#define PREFETCH1(x, y) asm volatile ("dcbt %0, %1" : : "r" (x), "b" (y) : "memory");
455+
#define PREFETCH1(x, y) asm volatile ("dcbt %0, %1" : : "b" (x), "r" (y) : "memory");
456456

457457
#if (defined(LEFT) && !defined(TRANSA)) || (!defined(LEFT) && defined(TRANSA))
458458
#define REFRESH_TEMP_BK(x, y) \

kernel/power/dgemm_kernel_power10.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ typedef FLOAT v4sf_t __attribute__ ((vector_size (16)));
104104
__builtin_mma_xvf64gerpp(&acc5, rowB1, rowA[2]);\
105105
__builtin_mma_xvf64gerpp(&acc6, rowB, rowA[3]);\
106106
__builtin_mma_xvf64gerpp(&acc7, rowB1, rowA[3]);
107-
#define PREFETCH1(x, y) asm volatile ("dcbt %0, %1" : : "r" (x), "b" (y) : "memory");
107+
#define PREFETCH1(x, y) asm volatile ("dcbt %0, %1" : : "b" (x), "r" (y) : "memory");
108108

109109
#if (defined(LEFT) && !defined(TRANSA)) || (!defined(LEFT) && defined(TRANSA))
110110
#define REFRESH_TEMP_BK(x, y) \

kernel/power/dgemm_ncopy_8_power10.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#include <stdio.h>
4040
#include "common.h"
4141
#include <altivec.h>
42-
#define PREFETCHA(x, y) asm volatile ("dcbt %0, %1" : : "r" (x), "b" (y) : "memory");
42+
#define PREFETCHA(x, y) asm volatile ("dcbt %0, %1" : : "b" (x), "r" (y) : "memory");
4343

4444
int CNAME(BLASLONG m, BLASLONG n, IFLOAT *a, BLASLONG lda, IFLOAT *b){
4545
BLASLONG i, j;

kernel/power/sbgemm_kernel_power10.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ typedef FLOAT v2sf_t __attribute__ ((vector_size (8)));
147147
__builtin_mma_xxsetaccz (&acc6); \
148148
__builtin_mma_xxsetaccz (&acc7);
149149

150-
#define PREFETCH1(x, y) asm volatile ("dcbt %0, %1" : : "r" (x), "b" (y) : "memory");
150+
#define PREFETCH1(x, y) asm volatile ("dcbt %0, %1" : : "b" (x), "r" (y) : "memory");
151151
/*************************************************************************************
152152
* SBGEMM Kernel
153153
*************************************************************************************/

kernel/power/sgemm_kernel_power10.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ typedef FLOAT v2sf_t __attribute__ ((vector_size (8)));
135135
__builtin_mma_xvf32gerpp (&acc6, rowB[i], rowA[j+3]); \
136136
__builtin_mma_xvf32gerpp (&acc7, rowB[i+1], rowA[j+3]);
137137

138-
#define PREFETCH1(x, y) asm volatile ("dcbt %0, %1" : : "r" (x), "b" (y) : "memory");
138+
#define PREFETCH1(x, y) asm volatile ("dcbt %0, %1" : : "b" (x), "r" (y) : "memory");
139139

140140
#if (defined(LEFT) && !defined(TRANSA)) || (!defined(LEFT) && defined(TRANSA))
141141
#define REFRESH_TEMP_BK(x, y) \

kernel/power/zgemm_kernel_power10.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ typedef FLOAT v4sf_t __attribute__ ((vector_size (16)));
221221
CO[2*ldc+CI+2] A_OP tr[3] * alpha_r - ti[3] * alpha_i; \
222222
CO[2*ldc+CI+3] A_OP ti[3] * alpha_r + tr[3] * alpha_i;
223223

224-
#define PREFETCH1(x, y) asm volatile ("dcbt %0, %1" : : "r" (x), "b" (y) : "memory");
224+
#define PREFETCH1(x, y) asm volatile ("dcbt %0, %1" : : "b" (x), "r" (y) : "memory");
225225

226226
#if (defined(LEFT) && !defined(TRANSA)) || (!defined(LEFT) && defined(TRANSA))
227227
#define REFRESH_TEMP_BK(x, y) \

0 commit comments

Comments
 (0)