Jittor / jittor

Jittor is a high-performance deep learning framework based on JIT compiling and meta-operators.
https://cg.cs.tsinghua.edu.cn/jittor/
Apache License 2.0
3.07k stars 310 forks source link

Some questions wanna disscuss #24

Open xqdan opened 4 years ago

xqdan commented 4 years ago

Hi,

Nice work! after went thru the code, some questions want to ask,

Thanks!

Gword commented 4 years ago

Thanks for your feedback.

xqdan commented 4 years ago

Thanks, make sense. more questions,

Thanks

xmyqsh commented 4 years ago

@xqdan shape could be inferred like this y = create_output(nullptr, x->dtype()); .

@Gword Where has been set resnet50's conv op to use cudnn? I can only refer to the nn.py implementation. How does the extern implementation to be selected?

jackmsye commented 4 years ago

@xmyqsh same confused as me. i saw some example and tests in python/jittor /test/test_cudnn_op.py, but I can not find how they triggle cudnn, the only flag in use_cuda=1

xmyqsh commented 4 years ago

@jackmsye I have got it!

267         string relay_conv_name = fop->flags.get(NodeFlags::_cpu) ?
268             "mkl_conv" : "cudnn_conv";
jackmsye commented 4 years ago

@xmyqsh thx, they just put on conv_tunner

xmyqsh commented 4 years ago

Some tuners use TunerManager, some tuners use PassManager, while others use both. Do you know why?

jackmsye commented 4 years ago

first they use jit compiler, when it is ops, it executes tunner_manager, you can see the code in src/ops_compiler.cc, then in TunnerManager, the function run_tunner's member is PassManager. see code in tuner_manager.cc

xmyqsh commented 4 years ago

@jackmsye Exactly! Can you give a brief summary of TunnerManager and PassManager?

    run_tuner<ReorderTuner>(&pm);
    run_tuner<BroadcastTuner>(&pm);
    run_tuner<ReduceTuner>(&pm);
    run_tuner<MatmulTuner>(&pm);
    run_tuner<ConvTuner>(&pm);
    run_pass<MarkRawPass>();
    run_pass<ReplaceForNumPass>();
    run_pass<LoopVarAnalyzePass>();
    run_pass<RemoveLoopPass>();
    run_pass<RenameLoopIndexPass>();
    run_pass<CompileShapesPass>();
....
    run_pass<SplitLoopPass>();
    run_pass<ReorderLoopPass>();
    run_pass<MergeLoopPass>();
    run_pass<ExpandEmptyBlockPass>();
    run_pass<SolveConflictDefinePass>();

    run_pass<RemoveIntermediatePass>();
....
    run_pass<SolveConflictDefinePass>();

    run_pass<RestridePass>();
....
    if (cc_type == "icc") {
        // only icc supports pragma
        run_pass<VectorizePass>();
        run_pass<UnrollPass>();
        run_pass<UnrollPass>();
    }
    run_pass<UseMovntPass>();
    run_pass<CheckCachePass>();
    run_pass<LoopToFuncPass>();
    run_pass<AssumeAlignedPass>();
    run_pass<ParallelPass>();
    run_pass<AtomicTunerPass>();
    run_pass<FloatAtomicFixPass>();
....
    run_pass<InsertProfileLoopPass>();
....
    run_pass<SolveConflictDefinePass>();
....
    run_pass<FakeMainPass>();
Jittor commented 4 years ago

Thanks @xmyqsh , we are polishing our backend documents and will be released soon~