Giter VIP home page Giter VIP logo

memoir's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

gmh5225 egelja

memoir's Issues

Update to new testing framework

To better organize the testing framework, I have added cmemoir/test.hpp, which allows you to register tests and expected outputs.

int main() {
  TEST(my_test) {
    int x = 0;
    expect(x == 0, "x not equal to 0");
  }
}

Low priority, but all existing tests should be ported to this structure.

What is the type of Struct::getType() ?

Might be a somewhat stupid question about C++ namespaces. I was always assuming that
memoir::Struct::getType() would be of type memoir::StructType as opposed to llvm::StructType.

Therefore, getNumFields, should be available. But in

Utility::debug() << "Struct Type has number of fields " << structType.getNumFields() << "\n";

The compiler emits an error as it is believing it to be an LLVM type instead.

image

I apologzie if this is a little too stupid but am a little curious on if i somehow misunderstood the namespaces.

Add an extensible property system

To allow passes to inject their own information into the program, and have it be more stable than metadata, we will add a function to do just that

memoir_property(PROPERTY_ID, ...)

PROPERTY_ID will be a unique ID for the given property. To simplify the compiler, this will be a string (const char *

A property takes an arbitrary number of arguments, allowing developers to implement properties however they want.

The Property base class will be implemented for developers to extend.

Field Affinity Analysis

We want to implement a hotness profiler to measure the hotness of a field within a given type.

Update the include directory structure.

The include directory structure needs to be fixed so that users can rely on it.
This issue is a location for discussion about the include directory, and will turn into a branch with the solution.

Add support for void element type

To allow users to more naturally represent sets, and allow SSA destruction to utilize set implementations for associative collections that do not use their value, add support for the void type element.

Sequences with void element types are currently unsupported, as I see no immediate use for them that couldn't be replaced with a single integer and simple for loops over scalars.

Add a MEMOIR Verifier

The Verifier will take a program and check the following conditions are met:

  1. The program is a valid LLVM program (using LLVM's verifier)
  2. All collections in the program maintain linearity (i.e., each collection can be typed linearly)
  3. (optional) The above check can be weakened, and instead check for affine typing, which does not require a collection to be used (this would essentially require that each collection also be deleted)
  4. (optional) For users who want to restrict the program to Gated Single Assignment (GSA) form, an irreducible control flow check can be added.

The goal of this verifier is to make assumptions explicit for passes that deal with destruction of MEMOIR collections.

Add support for non-memoir pointers

Add support for C-style pointers, generalize it as:

void *readPointer(field)
writePointer(field, void *ptr)

The developer is responsible for casting the void * to whatever pointer type they need.

Incorrect StructTypeSummary

In commit 9e68fb5 , the struct summary for test case test_correct_nested_type should return something like
(struct uint64 (struct uint64 uint64 ) uint64 uint64 )

but the actual result is
(struct uint64 (struct uint64 uint64 ) ) where the rest of the fields are ignored after a nested objected is inserted.

The objectlowering pass is modified to just print this out for this test case as a method of reproduction

Printing Struct Doesn't Terminate

The issue can be reproduced by commit 6493b05 and in reference to the test case test_recursive_type.

In the test case, if one tries to get the allocation summary of Object *myB = allocateStruct(bTy); where bTy is

Type *bTy = defineStructType("B",
                             2,
                             ReferenceType(StructType("A")),
                             ReferenceType(StructType("B")));

One can get that summary but printing out the type doesn't terminate, which seems to imply something a bit weird since the to string function just loops through the fields?

Object Splicing Mechanism

We need to implement a basic mechanism for object splicing optimizations (splitting/merging) that works on memoir types and patches up the related objects and their field references.

Add rfold instruction

memoir_rfold will have the same format as memoir_fold

FoldInst will be extended with a query to check if the fold is reverse or not.

Upgrade core MEMOIR functionality to LLVM18

This issue will track progress on upgrading MEMOIR to LLVM18.

Once closed, the current main branch will be renamed to v9 and v18 will become main.

General problems that fall under this issue:

  • Migrate to new pass manager
  • Handle opaque pointers by default, this will require either metadata or new API calls for typing

Change from slice/concatenation to insert/remove operations

Slice and concatenation operations require the compiler to identify and analyze diamond patterns that make engineering (and compilation time) expensive.

To remedy this, we need to encapsulate the most common of these operations in their own general-purpose operations.

Insert element.
s' = INS(s, [i] = v)
Insert range.
s' = INS(s, [i], s_ins)

Remove element.
s' = RMV(s, [i])
Remove range.
s' = RMV(s, [i:j])

Additionally, the semantics of slice will change to be a view:
s0 = s[i:j]

With this the mut2ssa transformations look as follows:

insert(s, i, v)       ==> s' = INS([i], v, s)
insert(s, i, s2)      ==> s' = INS([i], s2, s)
remove(s, i)          ==> s' = RMV([i], s)
remove(s, i, j)       ==> s' = RMV([i:j], s)
append(s, s2)         ==> s' = INS([end], s2, s)
swap(s, i, j, k)      ==> s0 = s[k:k+j-i]
                          s1 = DEF(s[i:j], s0)
                          s2 = s[i:j]
                          s' = DEF(s[k:k+j-i], s2)
swap(s, i, j, s2, i2) ==> s0 = s2[i2:i2+j-i]
                          s' = DEF(s[i:j], s0)
                          s2 = s[i:j]
                          s2' = DEF(s1[i2:i2+j-i], s2)
s2 = split(s, i, j)   ==> s2 = s[i:j]
                          s' = RMV([i:j], s)

This issue exists to nail down details of the change and work out any kinks before implementation.

No Object Summary Found

This issue can be reproduced by commit 3e19e57 and is also in reference to test_recursive_type.

The access analysis is failed to get access summary of Object *ptrToA = readReference(tmpField);

I am also seeing some cases here where even though there are only one TyB, the two types obtained from the two objects that built from this object do not have pointer equality. I suspect this has something to do with this problem as well.

Field Reordering Mechanism

We need to implement a basic mechanism for reordering fields within a given memoir type and patches up the related objects and their field references.

MEMOIR C++ Library

This issue tracks progress on the C++-specific library for MEMOIR, specifically trying to provide a natural drop-in replacement for stl collections.

Struct Access Assertion Failure

In Commit:
bc1e3ef

There is a test that just loops through the instructions, grabs the analysis content and does essentially nops:

Utility::debug() << "Struct accessed has code " << (int)struct_accessed->getCode() << "\n";

However, running against test:
https://github.com/arcana-lab/memoir/blob/bc1e3efb289e86214c843e71217296208e836540/tests/unit/struct_ref/main.cpp

The following error has occurred as shown in the print out:

image

Add a fold operation

The fold will take a collection, an initial value, a function and an arbitrary number of closed arguments.

memoir_fold(collection, initial_value, function, closure...)

The instruction has the following semantics (in C++):

For sequences:

seq = ...
memoir_fold(init, seq, foo, closed...)

executes as:

auto accum = init;
for (size_t i = 0; i < memoir_size(seq); ++i) {
    auto val = memoir_read(seq, i);
    accum = foo(accum, i, val, closed...);
}

For associative collections:

assoc = ...
memoir_fold(init, assoc, foo, closed...)

executes as:

auto accum = init;
for (const auto [key, val] : assoc) {
    accum = foo(accum, key, val, closed...);
}

NOTE: At the moment, all closure arguments are immutable. To mutate a closed variable, it must be passed as a pointer, which will be loaded and stored in the function.

NOTE: the function used by a fold instruction must be statically known, and must be a top-level function in the module.

Add ability to specify parameters as inout

To allow us to more flexibly mark the output variables of a function (e.g., those that are introduced by SSA construction) without having to change the function signature, we will add the memoir_out_<n>(value) function.

SSA construction will insert instructions within the function to signal that a given reaching definition is the live-out of the function for the given argument.

fn my_function(a):
    mut_write(v, a, i);
    ret

becomes

fn my_function(a):
    b = memoir_write(v, a, i)
    memoir_out_0(b)
    ret

The memoir_out_<n> function is statically parameterized on the corresponding argument number.

SSA construction will also insert Ret PHI instructions after call sites to redefine the values passed into the function.

a = ...
call my_function(a)
b = memoir_retphi(a, @my_function)

The memoir_retphi function takes the variable that was passed as an argument and the function value being called.

NOTE: this may necessitate that the compiler perform hyperblocking to disambiguate cases such as x = p ? y : z.

Extend normalization pass to insert PHI's for USE/DEF PHI dominance

Need to ensure that USE/DEF PHIs will dominate fellow users of a memoir collection.

To do this, we need to insert Control PHIs such that, for each memoir collection access that is reachable from another memoir collection access to the same memoir collection, a control PHI is inserted to maintain the dominance of the implicit USE/DEF PHI

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.