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

Use bool type from stdbool.h #398

Merged
merged 2 commits into from
Jun 26, 2024
Merged

Use bool type from stdbool.h #398

merged 2 commits into from
Jun 26, 2024

Conversation

developedby
Copy link
Member

@developedby developedby commented Jun 26, 2024

Defining bool ourselves can cause all sorts of problems. For example, if the implementation of the libraries we're using import another another definition of bool, HVM will not compile.

Or if a user tries to write FFI for HVM and includes a definition of bool.

One option was to #define bool _Bool, which is what stdbool does, but including the standard library is the more standard way of doing it.

Also, hvm.cuh tried to redefine bool in c++ which would cause an error.

Another effect is that we can now compile hvm with C23

@developedby developedby requested a review from enricozb June 26, 2024 14:09
@HigherOrderBot
Copy link
Collaborator

Perf run for 3e26bc2:

compiled
========

file            runtime         main            (local)       
==============================================================
sort_bitonic    c                        2.81s           3.15s
                cuda                     0.15s           0.15s
--------------------------------------------------------------
sum_rec         c                        1.48s           1.44s
                cuda                     0.06s           0.06s
--------------------------------------------------------------
sum_tree        c                        0.13s           0.13s
                cuda                     0.02s           0.02s
--------------------------------------------------------------
tuples          c                        4.50s           4.35s
                cuda                   timeout         timeout
--------------------------------------------------------------

interpreted
===========

file            runtime         main            (local)       
==============================================================
sort_bitonic    c                        3.35s           3.72s
                cuda                     0.15s           0.15s
                rust                   timeout         timeout
--------------------------------------------------------------
sum_rec         c                        1.75s           1.75s
                cuda                     0.06s           0.06s
                rust                    14.08s          14.03s
--------------------------------------------------------------
sum_tree        c                        0.22s           0.18s
                cuda                     0.02s           0.02s
                rust                     0.84s           0.84s
--------------------------------------------------------------
tuples          c                        5.34s           5.41s
                cuda                   timeout         timeout
                rust                     3.83s           3.60s
--------------------------------------------------------------


@Sipher
Copy link
Member

Sipher commented Jun 26, 2024

Tested this on my machine and worked

Macbook Pro M3. I was having trouble compiling HVM, now it is working smoothly

@developedby developedby merged commit aa3c64c into main Jun 26, 2024
4 checks passed
@developedby developedby deleted the stdbool branch June 26, 2024 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants