Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: Halide: Running BLAS operation from within a generator


I am trying to perform a matrix-matrix multiplication from within a Generator. I know I should be using define_extern as I have before with other functions, but for some reason with GEMM (i.e. BLAS' mat-mat multiply), I get a segfault.

Here's my code:

class TestBLAS : public Halide::Generator {
Input> A{"A", 2};
Input> B{"B", 2};
Output> C{"C", 2};

Var x,y;

void generate() {
Func g;
g.define_extern("hblas_sgemm", {false, false, 1.f, A, B, 0.f}, type_of(), 2);

C(x,y) = g(x,y);


In some apps/linear_algebra scripts, I found Halide::Runtime::Buffer::raw_buffer() being passed. How can I access this pointer from a Halide::GeneratorInput<:buffer> > or even a Halide::Func?

I'd understand the unknown bounds of the Func would make it difficult, but possibly there's a way to supply that information separately?

From the docs I don't seem to find a way...

Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered

This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: Halide: Running BLAS operation from within a generator


Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription