Replies: 11 comments
-
That's at least how I recall things. Hopefully I'm not misremembering anything as there can be some subtle but impactful differences here. @mtrofin will see this when he's back from vacation and correct me if I'm incorrect anywhere. |
Beta Was this translation helpful? Give feedback.
-
@boomanaiden154 Thank you for your informative answers! This is very helpful. |
Beta Was this translation helpful? Give feedback.
-
@boomanaiden154 just a follow-up question: So my understanding is that, during training, Clang loads a policy from disk and uses it to make an inline decision. Do the results from that get immediately fed back into the model and then the policy gets updated on disk? |
Beta Was this translation helpful? Give feedback.
-
During training, the log of the decisions that clang made using the policy loaded from disk are logged as a trajectory. The logs are then ingested by the tooling in this repository and used to train the model. We do a data collection phase where we compile a bunch of modules (512 is the default for regalloc), log all the trajectories, ingest them into the tooling here, do some training, and then iterate again. |
Beta Was this translation helpful? Give feedback.
-
That makes sense to me. While the model is being trained, does it get written back to disk to be used for subsequent decisions made in clang? |
Beta Was this translation helpful? Give feedback.
-
The training process is basically 2-phased, in the non- If you use |
Beta Was this translation helpful? Give feedback.
-
Thank you @mtrofin and @boomanaiden154 for your helpful answers. A lot of this is starting to make sense. I have another question. I notice the output (or "inlining_decision") is a single scalar value (shape(1)) for the "saved_policy". I'm not sure how it got transformed into that since |
Beta Was this translation helpful? Give feedback.
-
The network is just a tf_agents.networks.actor_distribution_network.ActorDistributionNetwork with some feed-forward layers. If everything is working how I assume, the output should just be a vector-vector multiplication of the last layer outputs and a weight vector at the end (and maybe some bias addition). I'd have to look into the details for how exactly the post-processing gets done however to confirm everything.
|
Beta Was this translation helpful? Give feedback.
-
Does expanding the dims in a Lambda layer have any impact, such as https://github.com/google/ml-compiler-opt/blob/main/compiler_opt/rl/feature_ops.py#L70 ? It's also done for identity and discard. |
Beta Was this translation helpful? Give feedback.
-
It shouldn't impact the output shape. The line you linked also calls You should be able to hook up a debugger (or even just do printf style debugging) to figure out how the tensors flow through the tooling. You'll probably hit the tracing stage rather than something at runtime due to how Tensorflow will construct the graph and then execute that rather than the python code, but that will give you a decent idea of the overall shape. |
Beta Was this translation helpful? Give feedback.
-
The |
Beta Was this translation helpful? Give feedback.
-
This isn't an issue. I wasn't sure where to ask these questions, so I posted them as an issue if that's ok.
I apologize in advance if these seem very obvious. (new to ML)
I have read through the MLGO paper as well.
MLGO Questions:
Beta Was this translation helpful? Give feedback.
All reactions