I did make a more complex grammar, something that is more representative of a real programming language
The way it works is that for every pair of characters, there is only allowed to be one possible part of a left-most derivation
to check the input, a set of stack changes is generated for every input pair - an array of items that are popped from a stack, and an array of items that are pushed
to verify the input all one needs to do is check whether that is balanced
So the complexity of a parse is related to two things mainly: the size of the input (obviously), and the average amount of stack changes per pair of characters
Gusten Theodor Isfeldt
@Gusten_Isfeldt_gitlab
Interesting. It's such an odd thing to do on a GPU.
1 reply
I was wondering how one would go about flattening it but it seems reasonable.
Is it an idea to add a check to the generated opencl whether a device supports the minimum required opencl version?
I have two OpenCL versions installed on my system, one is provided by mesa and only supports up to OpenCL 1.1, while the other one, which i ripped from amdgpu-pro, does support 1.2
unfortunately the mesa one appears first and i sometimes forget to pass -d. I know its not much to type that, but i think its appropriate if the generated code also checks for it and skips any incompatible devices.
(i set up a build environment for futhark the other day so i'm fine with contributing this myself, but i just want to know if this would be an appropriate thing to add)
Troels Henriksen
@athas
Futhark doesn't require more than 1.1, I think. Mesa is probably defective for other reasons. I've certainly never managed to get it to work.
Since Mesa might work for some people and in some future, I don't like the idea of blacklisting it. Presumably people who install the Mesa ICD also do it for a reason. The only thing we blacklist is Apple's CPU device, because it is completely dysfunctional, and users cannot get rid of it.
I wasn't suggesting blacklisting, but rather checking whether a target device supports opencl 1.2. I thought i read somewhere that futhark requires opencl 1.2
Troels Henriksen
@athas
I think I wrote that somewhere because we only test on 1.2 devices, but looking at the OpenCL spec, I don't think we actually use anything past 1.0 yet.
Ah. In that case it might be something else: when i run under mesa, it complains that cl_khr_fp64 is not enabled for the f64 intrinsic functions.
Troels Henriksen
@athas
Oh. Yes. Probably Mesa does not support double precision. Futhark does have code that tries to only include the double precision parts of the runtime system when the program needs it, but I'm not sure we test that code path anymore.