Kotlin / Kotlin/multik

Flaky: NativeLinAlg.dot matrix-matrix ComplexFloat returns wrong result on Linux

Open
#283 0 comments 0 reactions 0 assignees View on GitHub
ai-generated bug
Dominant language
Kotlin
Stars
734
Forks
51
Avg merge
9h 52m
Merged PRs (30d)
6

Description

### Multik version

0.3.0

### Module

multik-openblas

### Platform

JVM

### Operating System

Linux

### Description

`NativeLinAlg.dot` for matrix-matrix multiplication with `ComplexFloat` produces incorrect results intermittently on Linux (Ubuntu 22.04.5 LTS, gcc-12 12.3.0, JDK 21 Temurin). The test multiplies small integer ComplexFloat matrices and asserts with `assertComplexFloatingNDArray` using epsilon `1e-4f`. Failed in 2 out of 4 CI runs.

### Reproducer

```kotlin
val matrix1 = mk.ndarray(
mk[mk[ComplexFloat(1, 2), ComplexFloat(3, 4)],
mk[ComplexFloat(2, 3), ComplexFloat(4, 5)],
mk[ComplexFloat(3, 4), ComplexFloat(5, 6)]]
)
val matrix2 = mk.ndarray(
mk[mk[ComplexFloat(9, 8), ComplexFloat(7, 6), ComplexFloat(5, 4)],
mk[ComplexFloat(8, 7), ComplexFloat(6, 5), ComplexFloat(4, 3)]]
)

val actual = NativeLinAlg.dot(matrix1, matrix2)
assertComplexFloatingNDArray(expected, actual, 1e-4f) // Fails intermittently
```

### Additional information

```text
Flaky — failed in 2/4 CI runs.
AssertionFailedError at NativeLinAlgTest.kt:156.
CI runs: 22511673326, 22511861936.
Environment: Ubuntu 22.04.5 LTS, gcc-12 (12.3.0), g++-12, JDK 21 Temurin, x86_64.
```

Contributor guide

Open the contributing guide

Research direction

Start with the failing assertion at NativeLinAlgTest.kt:156 and the matrix-matrix ComplexFloat reproducer in the issue. Inspect the NativeLinAlg implementation in the multik-openblas module and compare behavior across the listed Linux CI environment. Done means the reproduced multiplication is stable and the test passes repeatedly with the stated epsilon.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.