Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bubble attribute error up #1478

Merged
merged 2 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions exla/c_src/exla/exla_mlir.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,7 @@ mlir::Type MLIRModule::ParseType(std::string string) {
}

mlir::Attribute MLIRModule::ParseAttribute(std::string string) {
auto attribute = mlir::parseAttribute(string, context_);

if (attribute == nullptr) {
std::cerr << "Unable to parse MLIR attribute: " << string << std::endl;
exit(1);
}

return attribute;
return mlir::parseAttribute(string, context_);
}

} // namespace exla
2 changes: 1 addition & 1 deletion exla/c_src/exla/exla_mlir.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class MLIRModule {

std::string ToString();

// Note: returns nullptr if the parsing fails
// Note: ParseAttribute and ParseType return nullptr if the parsing fails
mlir::Type ParseType(std::string);
mlir::Attribute ParseAttribute(std::string);

Expand Down
20 changes: 15 additions & 5 deletions exla/lib/exla/mlir/value.ex
Original file line number Diff line number Diff line change
Expand Up @@ -750,11 +750,21 @@ defmodule EXLA.MLIR.Value do

call_target_name =
case op_type do
{:f, 32} -> "qr_cpu_custom_call_f32"
{:f, 64} -> "qr_cpu_custom_call_f64"
{:f, 16} -> "qr_cpu_custom_call_f16"
{:bf, 16} -> "qr_cpu_custom_call_bf16"
type -> raise "QR decomposition not supported for type #{inspect(type)}"
{:f, 32} ->
"qr_cpu_custom_call_f32"

{:f, 64} ->
"qr_cpu_custom_call_f64"

{:f, 16} ->
"qr_cpu_custom_call_f16"

{:bf, 16} ->
"qr_cpu_custom_call_bf16"

type ->
# Due to matching on EXLA.Defn, we are sure that the device here is always :host
raise "QR decomposition not supported on :host device for type #{inspect(type)}"
end

attributes = [
Expand Down
Loading