Commit Graph

3859 Commits

Author SHA1 Message Date
Vlachopoulou, Eleni
edf64e2b89 GTestSuite: Adding data pool (#272)
* Adding data pool for random number generator

* Adopting pool in axpy, gemv, and ukr.gemm

* Using templates in data pool getter function to generate different pools for different ranges

* Addressing review comments

* Using data pool in more APIs

* Using data pool in more APIs

* Updating testing infra for trsv and trsm

* Addressing review comments

* Fixing numerical issues in trsm testing

* More review comments

* Small change to get trsm tests to pass

* Scalling tiny data pool

* Addressing review comments
2025-11-27 14:01:29 +00:00
Balasubramanian, Vignesh
f992942f6b Disabling GEMV(M1) rerouting in BF16 APIs(AVX512)
- Disabled rerouting to GEMV in BF16 APIs, in case of inputs
  having m == 1. We would now use the GEMM path for
  handling such inputs.

AMD-Internal: [CPUPL-7536]
Co-authored-by: Vignesh Balasubramanian <vignbala@amd.com>
2025-11-27 14:43:31 +05:30
Vlachopoulou, Eleni
5c42229e05 GTestSuite: Moving data generator definitions in a cpp file (#270)
* GTestSuite: Moving data generator definitions in a cpp file

- Using the same number in the rng engine for all tests
- Adjusting thresholds
2025-11-18 10:52:49 +00:00
Smyth, Edward
0923d8ff56 GTestSuite: break up tests
In earlier commits (e.g. a2beef3255) long running tests were broken
into separate executables for each data type. Standardize this approach
across all APIs, including separate executables for IIT_ERS tests, and
for each data type have separate executables for EVT tests.

AMD-Internal: [CPUPL-7386]
Co-authored-by: Vlachopoulou, Eleni <Eleni.Vlachopoulou@amd.com>
2025-11-17 09:12:03 +00:00
Vlachopoulou, Eleni
a8daea04ea GTestSuite: computediff improvements (#264)
* GTestSuite: computediff improvements

- Using lazy evaluation to only create error strings when the comparison failed
- Check if increments are zero, then only check first element
2025-11-17 08:30:20 +00:00
Vlachopoulou, Eleni
50f3520c33 GTestSuite: Fix in swap (#266) 2025-11-14 10:11:39 +00:00
Rayan, Rohan
979b547876 Make all bench applications consistent (#189)
Lots of the bench applications were not taking n_repeats as an argument on the command line (while others were).
Also adding the feature to skip the rest of the line (at the end) while reading bench inputs for all APIs

---------

Co-authored-by: Rayan <rohrayan@amd.com>
2025-11-13 07:42:53 +05:30
Sharma, Shubham
b60542c45c Added Fast path for single threaded AVX512 DGEMV kernel #260
- If blis is compiled as multithreaded library, BLIS_NUM_THREADS is set to 1, and sizes are large enough for multithreaded path to be optimal, we take multithreaded path even though we can spawn only one thread. This adds openmp overhead.
- A check has been added inside the multithreaded kernels to check to use single threaded code path of only 1 thread can be spawned.
AMD-Internal : [SWLCSG-3408]
2025-11-10 10:32:36 +05:30
S, Hari Govind
4ecfbde082 Fix extreme values handling in GEMV
- When alpha == 0, we are expected to only scale y vector with beta and not read A or X at all.
- This scenario is not handled properly in all code paths which causes NAN and INF from A and X being wrongly propagated. For example, for non-zen architecture (default block in switch case) no such check is present, similarly some of the avx512 kernels are also missing these checks.
- When beta == 0, we are not expected to read Y at all, this also is not handled correctly in one of the avx512 kernel.
- To fix these, early return condition for alpha == 0 is added to bla layer itself so that each kernel does not have to implement the logic.
- DGEMV AVX512 transpose kernel has been fixed to load vector Y only when beta != 0.

AMD-Internal: [CPUPL-7585]
2025-11-08 12:30:03 +05:30
Prabhu, Anantha
15cca23574 Delete .github/self_enablement_config.yaml 2025-11-07 23:09:59 +05:30
Prabhu, Anantha
7fdc1229db Delete .github/recipients.yaml 2025-11-07 23:09:59 +05:30
Prabhu, Anantha
15eca83c74 Delete .github/psdb-jenkins-trigger.yml 2025-11-07 23:09:59 +05:30
Prabhu, Anantha
66694a36e7 Delete .github/workflows/ai-code-review-trigger.yml 2025-11-07 23:09:59 +05:30
Prabhu, Anantha
90f1e8d183 Update ai_coverity.json 2025-11-07 23:09:59 +05:30
Prabhu, Anantha
77e4d229be Update ai-pr-platform-app.yml 2025-11-07 23:09:59 +05:30
Prabhu, Anantha
25d172b835 AI Coverity Fix - Historical Analysis related changes
Add AI Coverity Fix - Historical Analysis related changes
2025-11-07 23:09:59 +05:30
Tyagi, Shubham
b602b61601 Update ai-pr-platform-app.yml 2025-11-07 23:09:59 +05:30
Tyagi, Shubham
98164e06a6 Update ai-pr-platform-app.yml 2025-11-07 23:09:59 +05:30
Tyagi, Shubham
aebc02e2f3 Update ai-pr-platform-app.yml 2025-11-07 23:09:59 +05:30
Tyagi, Shubham
8c0196fef9 Add ai-pr-platform-app.yml 2025-11-07 23:09:59 +05:30
Smyth, Edward
85bd30ab3b DTL Windows getpid support
Use _getpid in Windows builds so that separate DTL log and trace
files are used for each process, e.g. each MPI rank.

AMD-Internal: [CPUPL-7524]
2025-11-07 17:03:25 +00:00
Varaganti, Kiran
9230c978a1 Fixed Data Race in Native code-path (#251)
```c
_Pragma( "omp parallel num_threads(n_threads)" )
{
    // ... thread work ...

    // Free the current thread's thrinfo_t structure.
    bli_l3_thrinfo_free( rntm_p, thread );  // Line 183
}
// *** MISSING BARRIER HERE! ***

// Check the array_t back into the small block allocator...
bli_sba_checkin_array( array );  // Line 200
```

```c
// DANGEROUS execution timeline:
Thread 0 (chief):
    completes func()
    calls bli_l3_cntl_free()
    calls bli_l3_thrinfo_free() → frees gl_comm ✓
    exits OpenMP parallel region
    calls bli_sba_checkin_array(array) → frees array ✗

Thread 1,2,3 (still executing):
    still in func() or bli_l3_cntl_free()
    trying to access freed gl_comm → CRASH!
    trying to access freed array pools → CRASH!
```

This is **exactly the same issue** that PR #702 fixed in other files! The function needs a barrier before threads exit the parallel region to ensure:

1. **All threads complete their work** before any cleanup starts
2. **Global communicator isn't freed** while other threads are using it
3. **Array pools aren't freed** while other threads are accessing them
2025-11-07 10:49:19 +05:30
Varaganti, Kiran
7ac261b173 Replaced omp barrier with bli_thread_barrier and added similar fix fo… (#248)
* Replaced omp barrier with bli_thread_barrier and added similar fix for pack compute routine

## **The Sequence is Critical:**

1. **All threads execute `func(...)`** - may access shared resources including communicators
2. **Barrier ** - ensures ALL threads finish their work
3. **Then each thread calls `bli_l3_sup_thrinfo_free()`** - only chief actually frees gl_comm
4. **Safe cleanup** - no use-after-free because all threads are done using gl_comm

## **What Would Happen Without the Barrier:**

```c
// Thread execution timeline WITHOUT barrier:
Time 1: Thread 0 finishes func() early → immediately calls bli_l3_sup_thrinfo_free()
Time 2: Thread 0 (chief) frees gl_comm
Time 3: Thread 1,2,3... still in func() → try to use freed gl_comm → CRASH!
```

## **With the Barrier (Current Safe Code):**

```c
// Thread execution timeline WITH barrier:
Time 1: All threads finish func() at different times
Time 2: ALL threads reach barrier → wait for slowest thread
Time 3: ALL threads proceed past barrier together  
Time 4: Chief frees gl_comm → safe because no one using it anymore
```
2025-10-31 10:01:40 +05:30
Varaganti, Kiran
49961aa569 Fix DTL dynamic thread logging in BLAS operations (#230)
- Remove redundant AOCL_DTL_LOG_NUM_THREADS calls from early return paths
- Update thread count logging to use AOCL_get_requested_threads_count() for early exits
- Clean up duplicate DTL logging in gemv_unf_var1 and gemv_unf_var2 implementations
- Remove thread count logging from bli_dgemv_n_zen4_int kernel variants
- Simplify aocldtl_blis.c AOCL_DTL_log_gemv_sizes by removing redundant conditional
- Standardize DTL trace exit patterns across axpy, scal, and gemv operations
- Remove commented-out DTL logging code in zen4 gemv kernel

This patch ensures thread count is logged only once per operation and uses
the correct API (AOCL_get_requested_threads_count) for early exit scenarios
where the actual execution thread count may differ from requested threads.
AOCL-Weekly-241025
2025-10-24 13:34:00 +01:00
Dave, Harsh
90d252d59a Add OpenMP barrier before releasing threadinfo & global communicator to avoid race (#225)
- Added `#pragma omp barrier` just before threads start releasing their threadinfo / global
  communicator.
- This ensures all threads reach this sync point, preventing interleaved cleanup.

Co-authored-by: harsdave <harsdave@amd.com>
2025-10-24 16:22:45 +05:30
S, Hari Govind
ab25b825aa Fix: Resolve Operator Precedence Warning in Zen5 DCOMPLEX Threshold Logic
- Add explicit parentheses around (n <= 1520) && (k <= 128) to clarify
  operator precedence and resolve compiler warning. The intended logic
  is (m <= 1380) OR (n <= 1520 AND k <= 128).

- This change eliminates the compiler warning about mixing || and &&
  operators without explicit grouping.
2025-10-24 14:23:23 +05:30
Rayan, Rohan
e85be22da0 Adding tiny path for SGEMM (#237)
Adding SGEMM tiny path for Zen architectures.
Needed to cover some performance gaps seen wrt MKL
Only allowing matrices that all fit into the L1 cache to the tiny path
Only tuned for single threaded operation at the moment
Todo: Tune cases where AVX2 performs better than AVX512 on Zen4
Todo: The current ranges are very conservative, there may be scope to increase the matrix sizes that go into the tiny path

AMD-Internal: CPUPL-7555
Co-authored-by: Rohan Rayan rohrayan@amd.com
2025-10-24 13:14:33 +05:30
V, Varsha
fecb1aa7a5 Bug Fix in BF16 AVX2 conversion path (#236)
- In the current implementation of bf16 to f32 conversion for packed data
 we handle both GEMM and GEMV conditions in the same function separated
 with conditions.
 - But, when n = (NC+1) the function would execute GEMV conversion logic
 and write back the data inaccurately leading to accuracy issues.
 - Hence, modified the convert function and reorder functions to have
 separate conversion logic to make it cleaner and avoid confusions.
 -  Also, updated the API calls to adhere to the changes appropriately.

[AMD-Internal: CPUPL-7540]
2025-10-17 15:38:02 +05:30
S, Hari Govind
0ce45e3147 Changing ZGEMM SUP threshold logic for zen5 to fix performance regression (#233)
- Revert the logical operator from OR (||) to AND (&&) in the DCOMPLEX
  (ZGEMM) SUP threshold condition for k <= 128. The previous change to
  OR logic was causing performance regressions for certain input sizes
  by incorrectly routing cases to the SUP path when the native path
  would be more optimal.
2025-10-17 11:25:33 +05:30
Sharma, Shubham
1dca574a9d Improved fringe case handling for AVXPV kernel (#228)
- Current kernel uses masked AVX512 instructions to handle fringe cases.
- These instructions are slow on genoa.
- To handle sizes less than 8, AVX2 and SSE code has been added.
- Existing masked AVX512 code is performing better when n > 8 therefore it is still kept for handling larger sizes where n % 8 != 0.

AMD-Internal: [CPUPL-7467]
AOCL-Oct2025-b2
2025-10-10 14:25:35 +05:30
Varaganti, Kiran
e857899cb3 Added dynamic threads and actual threads in the DTL log of SAXPY (#224) 2025-10-08 10:25:25 +05:30
Smyth, Edward
804d4a9f38 Compiler warnings fixes (3)
Recent changes meant nt was defined but unused for serial builds
when DTL was not enabled. Restructure code to avoid this issue and
make the code more readable.

AMD-Internal: [CPUPL-6579]
2025-10-03 11:51:10 +01:00
Rayan, Rohan
dc4e0f72c1 Fixing an integer division in GEMV that was supposed to be a double operation (#218)
---------

Co-authored-by: Rayan <rohrayan@amd.com>
2025-09-30 14:04:39 +05:30
Prabhu, Anantha
f0f5b4c612 Update codeql_cpp_placeholder.yml
Update codeql_cpp_placeholder file to stop running it for each PR.
2025-09-26 12:04:43 +05:30
Prabhu, Anantha
9933093239 Add CodeQL analysis workflow for C/C++ and Python
Adding CodeQL advanced analysis workflow for C/C++ and Python
2025-09-26 11:33:38 +05:30
Dave, Harsh
c9933886f7 Tuned zgemm threshold for zen5 (#215)
Threshold tuning that determines whether SUP or native path should
be used for given input matrix size.

This tuning forces skinny matrices to take SUP path to ensure better
performance.

AMD-Internal: [CPUPL-7369]

Co-authored-by: harsh dave <harsdave@amd.com>
2025-09-23 08:05:31 +05:30
Bhaskar, Nallani
db3134ed6d Disabled no post-ops path in lpgemm f32 kernels for few gcc versions
Guarded np (no post-ops) path in f32 API with a macro 
 as a workaround as gcc 11.4 and 11.2 are giving accuracy issues 
 with np path.
2025-09-22 15:52:21 +05:30
Varaganti, Kiran
807de2a990 DTL Log update
* DTL Log update
Updates logs with nt and AOCL Dynamic selected nt for axpy, scal and dgemv
Modified bench_gemv.c to able to process modified dtl logs.

* Updated DTL log for copy routine with actual nt and dynamic nt

* Refactor OpenMP pragmas and clean up code

Removed unnecessary nested OpenMP pragma and cleaned up function end comment.

* Fixed DTL log for sequential build

* Added thread logging in bla_gemv_check for invalid inputs

---------

Co-authored-by: Smyth, Edward <Edward.Smyth@amd.com>
2025-09-22 11:32:00 +05:30
Chandrashekara K R
03685d1ad9 Add external PR integration process and flowchart to CONTRIBUTING.md
1. Documented the process for handling external pull requests,
   including validation, review, and notification steps.
2. Added a markdown flowchart illustrating the PR workflow.
3. Included communication and contributor attribution notes.
2025-09-19 22:46:25 +05:30
Dave, Harsh
7076294286 Enabled disable-sba-pools feature in AOCL-BLAS (#101)
Co-authored-by: harsh dave <harsdave@amd.com>
2025-09-19 21:45:08 +05:30
Sharma, Arnav
ee3d250b7a Fix for F32 to BF16 Conversion and AVX512 ISA Support Checks
- Fixed register assignment bug in lpgemv_m_kernel_f32_avx512 where zmm3
  was incorrectly used instead of zmm4 in BF16_F32_BETA_OP_NLT16F_MASK macro.

- Replaced hardware-specific BF16 conversion intrinsics with manual
  rounding, bit manipulation and F32 instruction set for compatibility on
  hardware without native BF16 support.

- Added AVX512_BF16 ISA support checks for s8s8s32obf16 and u8s8s32obf16
  GEMM operations to ensure processor compatibility before execution.

AMD-Internal: [CPUPL-7410]
AOCL-Weekly-190925
2025-09-19 18:49:33 +05:30
Varaganti, Kiran
ec5cf7d174 Fixed Integer Overflow Issue in TPSV
- In the TPSV APIs, operations such as (*n - 1) * *incx and *n * (*n + 1) may lead to overflow when using bla_integer. To mitigate this risk, these operations have been updated to use dim_t variables instead of bla_integer.
2025-09-19 14:58:35 +05:30
pr_platform, a1
bf984462c7 Add AI Code Review workflow (#211)
Automated enablement of AI Code Review capabilities
2025-09-19 14:12:33 +05:30
Rao, Pradeep
91e01fbeac Add AI Code Review Self-enablement file (#209)
This will enable triggering AI Code Review tool when PR is raised
2025-09-19 13:39:53 +05:30
Sharma, Shubham
773d3a3d45 Re-tuned GEMV thresholds (#210)
Retune DGEMV AVX512 non transpose thresholds to avoid regression on ZEN4.

AMD-Internal: [CPUPL-7448]
2025-09-19 12:43:50 +05:30
S, Hari Govind
a9df3fd8d5 Adding bli_print_msg before bli_abort() for bli_thrinfo_sup_create_for_cntl
- Adding bli_print_msg to print failure message bout bli_abort in
  bli_thrinfo_sup_create_for_cntl function.
2025-09-19 10:53:50 +05:30
Smyth, Edward
823ec2cd40 Add missing license text
Some files have copyright statements but not details of the license.
Add this to DTL source code and some build and benchmark related
scripts.

AMD-Internal: [CPUPL-6579]
2025-09-18 12:04:59 +01:00
Sharma, Shubham
10b2e59782 Modified AVPY kernel to ensure consistency of numerical results (#188)
Current DAXPY kernel uses C code to solve cases when n %8 != 0.
This results in the compiled code using MUL+ADD instruction using SSE, instead of FMA instruction.
This causes inconsistency of numerical results.
To fix this, AVX2 and C code is replaced with masked AVX512 instructions to compute fringe cases.

AMD-Internal : [CPUPL-7315]
2025-09-18 11:42:31 +05:30
Sharma, Shubham
740fbdf50d Fix memory leak in DGEMV kernel (#187)
Memory is not freed for GEMV when MT kernel with called for NT = 1;
Fixed this by adding an extra check to make sure memory is freed.

AMD-Internal: [CPUPL-7352]
2025-09-18 11:18:13 +05:30
Sharma, Shubham
a02020686c Tuned DGEMV no-transpose thresholds #193
In order to avoid regression in some sizes, thresholds are retuned and scope of 32x8 kernels is expanded.

AMD-Internal:[CPUPL-7336]
2025-09-18 10:50:09 +05:30