daphne-eu / daphne

DAPHNE: An Open and Extensible System Infrastructure for Integrated Data Analysis Pipelines
Apache License 2.0
67 stars 62 forks source link

Missing code generation for sum of integer matrices #663

Open resting-dove opened 9 months ago

resting-dove commented 9 months ago

Related issue https://github.com/daphne-eu/daphne/issues/662#issue-2154646268 Daphne supports code generation for the sum(A) operation of f64 valued matrices A. Code generation is not available for f32, si64, si32, ui64, ui32 value types.

Code to produce the issue:

N = 4;
A = as.matrix<f32>(fill(3.0, N, N));
print(sum(A));

Output:

error: failed to materialize conversion for result #0 of operation 'daphne.sumAll' that remained live after conversion
module {
  func.func @main() {
    %0 = "daphne.constant"() {value = 4 : index} : () -> index
    %1 = "daphne.constant"() {value = false} : () -> i1
    %2 = "daphne.constant"() {value = true} : () -> i1
    %3 = "daphne.constant"() {value = 3.000000e+00 : f64} : () -> f64
    %4 = "daphne.fill"(%3, %0, %0) : (f64, index, index) -> !daphne.Matrix<4x4xf64>
    %5 = "daphne.cast"(%4) : (!daphne.Matrix<4x4xf64>) -> !daphne.Matrix<4x4xf32>
    %6 = "daphne.sumAll"(%5) : (!daphne.Matrix<4x4xf32>) -> f32
    "daphne.print"(%6, %2, %1) : (f32, i1, i1) -> ()
    "daphne.return"() : () -> ()
  }
}
loc("/$user/sumAll.daph":0:0): error: module pass error
resting-dove commented 9 months ago

Code generation for f32, si64 and ui64 value types is added in #653.