Giter VIP home page Giter VIP logo

Comments (6)

athas avatar athas commented on May 19, 2024

Note that all of this requires fairly minor changes to the compiler.

from futhark.

athas avatar athas commented on May 19, 2024

For a start, I changed the interpreter to use 32-bit signed integers internally.

from futhark.

athas avatar athas commented on May 19, 2024

real has already become float32 and float64. We could easily add float16, which I believe is supported by some GPUs. I think byte is a bad name, and we should use uint8 or word8 instead. As I recall, LLVM uses i32 for a signed 32-bit integer, and u32 for an unsigned 32-bit integer. This is also an okay name, but perhaps the succintness is excessive.

from futhark.

athas avatar athas commented on May 19, 2024

I will do this soon, as it is necessary to support some benchmarks (like Hashcat from Accelerate). For the internal language, I will most likely copy the LLVM type system: http://nondot.org/~sabre/LLVMNotes/TypeSystemChanges.txt and http://llvm.org/docs/LangRef.html#first-class-types

One interesting feature of the LLVM type system is that there is no distinction between unsigned and signed integer types. In LLVM, you use distinct instructions (like sdiv versus udiv) instead, which is really what you want in a IL anyway.

The external language will have distinguished signed/unsigned types, of course.

The only thing I need to figure out is how to express casts/conversions between the different types. There should of course be the three usual rounding functions from any floating point type to any integer type (and back), but we also need conversion functions between the integers - both sign-extending and zero-extending. And of course, these shouldn't really be "functions" in the internal language, but built-in constructs. I think they should look like functions in the external language, though.

from futhark.

athas avatar athas commented on May 19, 2024

Also, like C and LLVM (kind of), signed overflow will be undefined. This is mostly to help with range analysis, where x+1>x is a very nice property to have.

from futhark.

athas avatar athas commented on May 19, 2024

I did part of this. The only thing missing is to add unsigned types. I have come to the conclusion that I do not want automatic type coercion/conversion - it will be more verbose, but you will know what's going on.

from futhark.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.