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

Exception when negating a fiber #383

Closed
mtsokol opened this issue Jan 19, 2024 · 7 comments
Closed

Exception when negating a fiber #383

mtsokol opened this issue Jan 19, 2024 · 7 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@mtsokol
Copy link
Member

mtsokol commented Jan 19, 2024

Hi @willow-ahrens,

While running different configurations of levels I noticed that for negation I get an exception. Here's a code where I could reproduce it:

using Finch

A = [0.0 0.0 4.4; 1.1 0.0 0.0; 2.2 0.0 5.5; 3.3 0.0 0.0]
A_fbr = Tensor(Dense(Dense(Element(0.0))), A)

-A  # works
-A_fbr # fails
ERROR: Finch.FinchProtocolError("Cannot initialize Element Levels to non-default values (have literal(0.0) expected -0.0)")

Is negation for sparse fibers done differently or is it a bug?

@willow-ahrens
Copy link
Collaborator

Oh, interesting. Here's my question: Should the fill value of -A be 0.0 or -0.0?

@willow-ahrens
Copy link
Collaborator

because

julia> A = [0.0 0.0 4.4; 1.1 0.0 0.0; 2.2 0.0 5.5; 3.3 0.0 0.0]
4×3 Matrix{Float64}:
 0.0  0.0  4.4
 1.1  0.0  0.0
 2.2  0.0  5.5
 3.3  0.0  0.0

julia> -A
4×3 Matrix{Float64}:
 -0.0  -0.0  -4.4
 -1.1  -0.0  -0.0
 -2.2  -0.0  -5.5
 -3.3  -0.0  -0.0

@willow-ahrens
Copy link
Collaborator

Somehow, it looks like the fill value isn't getting set correctly.

@willow-ahrens
Copy link
Collaborator

willow-ahrens commented Jan 19, 2024

Could you work around this for now? I'm completely reorganizing these convenience functions to follow a different codepath (for the @compile macro), so this may magically get fixed in the future.

@mtsokol
Copy link
Member Author

mtsokol commented Jan 19, 2024

Sure! It isn't a blocker for me, just wanted to share.

@willow-ahrens
Copy link
Collaborator

Thanks for filing the issue! I'll double check that it's fixed once I'm done.

@willow-ahrens
Copy link
Collaborator

Mateusz, I think the approach to try to fix this is to remove https://github.com/willow-ahrens/Finch.jl/blob/e6544d80f3da3973614634236cede0c360b0b493/src/symbolic/simplify_program.jl#L73C1-L73C50 and see if anything breaks terribly.

@willow-ahrens willow-ahrens added bug Something isn't working good first issue Good for newcomers labels May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants