facebookresearch / CompilerGym

Reinforcement learning environments for compiler and program optimization tasks
https://compilergym.ai/
MIT License
876 stars 123 forks source link

Stateless Service #89

Open hughleat opened 3 years ago

hughleat commented 3 years ago

Making the service stateless would make everyone happy! This feature req is more a place for thrashing out ideas.

Basic idea is that the service has a set of things, indexed by some hashes. The client asks for operations to be done to a thing. The service does them and returns the results.

Two commands:

A session might look like:

The service would be responsible for caching command and query results to make things fast.

Not sure about time to live - especially for uploads.

hughleat commented 3 years ago

Chris, I like your idea about just having it based on hashes :-)

ChrisCummins commented 3 years ago

Thanks for writing this up @hughleat!

One thing I would like to take a quick look at before diving in is to see what the overhead of calculating a hash is on every step. AFAIK the best way of generating a hash for LLVM-IR is writeModule(), which might be quite expensive for larger programs.

Cheers, Chris

hughleat commented 3 years ago

Possibly hashing could be avoided unless explicitly asked for:

hughleat commented 3 years ago

BTW, could also possibly do things like:

hughleat commented 3 years ago

Actually, upload could just be a command, too:

From the service perspective, the client calling get-hash suggests that caching that thing for a while might be helpful. Not that it shouldn't cache other things, too, but at least make those things more likely to survive when something has to be evicted from the cache.

hughleat commented 3 years ago

Possibly allow get-hash to create a name that can then be reused.