Skip to content

Conversation

@leios
Copy link
Owner

@leios leios commented Aug 5, 2024

This PR should implement all the functionality from Fable.jl (it might take a while).

Quibble features

Sanity checks

  • All mallocs have been freed

@leios
Copy link
Owner Author

leios commented Aug 7, 2024

Notes on quibble contexts:

  1. create_default_context could read in a QUIBBLE_GPU or QUIBBLE_CPU, which will go through all available platforms to find the correct GPU / CPU
  2. I guess the correct way to do this is to create a priority list of possible devices and then query through until the right one is found.

@leios
Copy link
Owner Author

leios commented Aug 16, 2024

@leios leios mentioned this pull request Aug 28, 2024
10 tasks
@leios leios mentioned this pull request Jun 11, 2025
20 tasks
@leios
Copy link
Owner Author

leios commented Jun 25, 2025

I need to think about variable reuse:

__verse mult_by(a | float factor = 8;){
    a[_idx] *= factor;
}

__stanza stanza_check(a, b, c | float r = 1.0;){
    c[_idx] = a[_idx] + b[_idx];
    __split_stanza();
    c[idx] += 1;
}

__poem poem_check(float *a, float *b, float *c, stanza_num){
    if (stanza_num == 0){
        @SCALL stanza_check(a, b, c){
            @VCALL mult_by(c | factor = 2;);
        }
    }
}

Goes to:

__kernel void poem_check(float *a, float *b, float *c, stanza_num){
    int _idx = get_global_id(0);

    if (stanza_num == 0){
        {
            a = a;
            b = b;
            c = c;
            float r = 1.0;

            c[_idx] = a[_idx] + b[_idx];
            {
                a = c;
                float factor = 8;

                a[_idx] *= factor;
            }
            c[idx] += 1;
        }

    }

}

And the variables a, b, and c are redefined. Solutions"

  1. Ask users to keep in mind that variables must all have different names and use correct C, so f(a) -> f(int a_internal), which will then create a_internal = a if called with f(a). This is a fine solution for the short-term, but might need a more elegant solution in the long term
  2. Write a new function to replace all occurrences of a particular variable name with another one, so all a variables are tagged with _unique_id, and then we go through the code and replace all a's with a_unique_id. This can obviously go haywire if we accidentally change an a in other words / phrases like variable -> va_unique_idriable or something. I think it's possible with some simple rules (checking for spaces before and after the variable or else an open bracket on the right side).

@leios
Copy link
Owner Author

leios commented Jun 25, 2025

nevermind. C's... uh, C:

#include "stdio.h"

int main(){
    int n = 0;
    {
        int n = 1;
        printf("%d\n", n);
    }
    printf("%d\n", n);
    return 0;
}
[leios@noema tmp]$ gcc squiggle_check.c 
[leios@noema tmp]$ ./a.out 
1
0

@leios leios marked this pull request as ready for review July 10, 2025 13:21
@leios leios merged commit a608a6b into main Jul 10, 2025
@leios leios mentioned this pull request Jul 12, 2025
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.

2 participants