Search Unity

Has Unity tried applying Machine Learning Algorithms to build pipeline e.g Compilers/Burst/WASM

Discussion in 'General Discussion' started by Arowx, Jul 3, 2020.

Thread Status:
Not open for further replies.
  1. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    With MLA (Machine Learning Algorithm) being very good at pattern recognition it could also benefit the performance and optimisation of the build pipeline.

    Unity has quite a few complex compiler pipelines e.g. Tiny/WebGL/Burst that need to go through a number of stages to produce the final output code.

    An MLA could be trained with the inputs and outputs with enough examples to do the compilation in a single cycle.

    Pros: Massive reduction in compilation stages, time and memory/file usage.
    Cons: Possibly a huge learning space to train through.

    The potential problems are how large would such an MLA need to be, for instance if it is too large then it might be inherently slow as updating it would require a lot of memory and processing power.

    Combined with the training needed to ensure it provides 100% code coverage.

    But if the ML was small enough to work alongside the Editor in theory it could be compiling code as programmers generate the code allowing for near instant builds.
     
  2. Zuntatos

    Zuntatos

    Joined:
    Nov 18, 2012
    Posts:
    612
    What you want for an optimizing compiler is 100% the same output for the same input, just quicker.

    ML basically by its definition doesn't deal in 100%'s. It does a best effort, which may be 10%, 50%, 90% or 99.9%. Sometimes it fails catastrophically.

    You can't check whether your ML-optimized-assembly is correct or not, because you run into the halting problem.

    It's the same issue self-driving cars run into, where the solution is a S*** ton of code and a lot of effort.

    You're not shadowbanned yet :)

    (P.S. I'm aware of stuff like -ffast that is not 100% same output)
     
    Arowx likes this.
  3. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    In theory it should be possible to convert a multi stage token conversion process to a single stage one that provides 100% accuracy.

    And there are quite a number of multi stage pipelines in Unity that could benefit from a transition to single stage.
     
  4. Zuntatos

    Zuntatos

    Joined:
    Nov 18, 2012
    Posts:
    612
    Sure, in theory you can merge most compile steps into one big all-knowing-compiler and get better performance (both in compiling and resulting speed). But there's lower hanging fruit typically as merging these things takes a lot of time and complex knowledge, and makes stuff hard to maintain afterwards. Human time limited :)

    To do it with AI you run into the problems of my previous post, which you haven't addressed
     
  5. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    In theory an ML system could be trained to be 100% reliable.

    However your claim that it needs to produce 100% the same output does not take into account optimisations an ML might be able to add to code that a multi-stage compiler could remove or hide as the code cycles through the stages.

    In addition as we already have the existing build pipeline we could run periodic checks for compliance or to remedy errors and improve the ML while it's in beta so a 99% (or less) system could work well enough for most and be launchable as a beta system that then is improved by the community using it.
     
  6. antonsingov

    antonsingov

    Joined:
    May 11, 2014
    Posts:
    15
    Why do you say that? I really doubt this can be shown to be true in any non-trivial case.
     
  7. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    You should have a go at the things you keep saying can be done "in theory".
     
  8. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,052
    Not much to do with game development, and nothing practical. Theory without application is magical “make game”. button. If you execute on your theory above, feel free to post it. Until then, off topic.
     
Thread Status:
Not open for further replies.