Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BugFix: Batch_Norm Scheduling with JIT=1 #225

Closed
hikettei opened this issue Nov 15, 2024 · 1 comment
Closed

BugFix: Batch_Norm Scheduling with JIT=1 #225

hikettei opened this issue Nov 15, 2024 · 1 comment
Labels
bug Something isn't working compiler (codegen) compiler things only related to the jit codegen

Comments

@hikettei
Copy link
Owner

CATEN/TEST-SUITE> (caten (!batch-norm (make-tensor `(3 3))))
WARNING: !batch-norm is not tested
WARNING: BatchNorm is not tested
WARNING: BatchNorm is not tested
[graph-schedule] Schedule Graph:

FastGraph[seen=NIL, outputs=(val_30)] {
    { Allocate } : [ val_8 <- (3 1) where lowered-p=nil ]
    { Allocate } : [ val_6 <- (3 1) where lowered-p=nil ]
    { Allocate } : [ val_4 <- NIL where lowered-p=nil ]
    {  KERNEL  } : [ val_21 <- val_4, val_6, val_14 where lowered-p=nil :name=FUSED_VARIANCENODE_MEANNODE_SUMNODE531928]
    { Allocate } : [ val_2 <- NIL where lowered-p=nil ]
    { Allocate } : [ val_0 <- NIL where lowered-p=nil ]
    { Allocate } : [ val_14 <- (3 3) where lowered-p=nil ]
    {  KERNEL  } : [ val_29 <- val_14, val_17, val_28, val_0, val_2, val_21, val_8 where lowered-p=nil :name=FUSED_STDNODE_SUMNODE_VARIANCENODE_BATCHNORM531948]
    {   VMOP   } : [ val_30 <- val_29 where lowered-p=nil :name=FUSED_BACKWARD531914]
}

[18:48:49, 11/15/2024 (GMT+9)] : JIT Compilation Start (AVM=MAIN526805)

* (1/2) FUSED_VARIANCENODE_MEANNODE_SUMNODE531928
=====> Lowering to blueprint
{
  for (int _gid0=0;(_gid0<3);_gid0+=1) {
    val_7 = 0.0;
    for (int _gid1=0;(_gid1<3);_gid1+=1) {
      val_7 = (val_7+val_14[((_gid0*3)+_gid1)]); // :reduction=t
    } // _gid1
    val_21[_gid0] = -((val_7*0.33333334));
  } // _gid0
}
Compilation Time : 0.005008(sec)
* (2/2) FUSED_STDNODE_SUMNODE_VARIANCENODE_BATCHNORM531948 

=====> Lowering to blueprint
{
  for (int _gid0=0;(_gid0<3);_gid0+=1) {
    val_9 = 0.0;
    for (int _gid1=0;(_gid1<3);_gid1+=1) {
      val_22 = (val_14[((_gid0*3)+_gid1)]+val_21[_gid0]);
      val_9 = (val_9+(val_22*val_22)); // :reduction=t
    } // _gid1
    for (int _gid1=0;(_gid1<3);_gid1+=1) {
      val_29[((3*_gid0)+_gid1)] = ((val_14[((_gid0*3)+_gid1)]+val_17[_gid0])*1/((sqrt((val_9*0.5))+1.0e-5)));
    } // _gid1
  } // _gid0
}
Compilation Time : 0.010728(sec)

graph-outputs (val_30) was removed during verification process.
To sort the graph properly, resolve the following isolated graph dependencies.

== [Report: backtrace on val_30] ===============
[*NG*: val_30 was stashed because (val_29) is not defined]
  [*NG*: val_29 was stashed because (val_17 val_21 val_14) is not defined]
    [**FIXME**: val_17 is not defined in the original graph.]
      -> In {  KERNEL  } : [ val_29 <- val_17, val_21, val_14 where lowered-p=t :name=FUSED_STDNODE_SUMNODE_VARIANCENODE_BATCHNORM531948]
    [OK: val_21 satisfies all requirements]
    [OK: val_14 satisfies all requirements]
   [Condition of type SIMPLE-ERROR]

Restarts:
 0: [CONTINUE] Retry assertion.
 1: [RETRY] Retry SLIME REPL evaluation request.
 2: [*ABORT] Return to SLIME's top level.
 3: [ABORT] abort thread (#<THREAD "new-repl-thread" RUNNING {705893E2D3}>)

Backtrace:
  0: (SB-KERNEL:ASSERT-ERROR (EVERY (FUNCTION (LAMBDA # #)) (GRAPH-OUTPUTS GRAPH)) 2 (FUNCTION (LAMBDA (CATEN/AIR::X) (OR # #))) #<FUNCTION (LAMBDA (CATEN/AIR::X) :IN CATEN/AIR::RESOLVE-ISOLATED-NODES) {70..
  1: ((:METHOD CATEN/AIR::RESOLVE-ISOLATED-NODES (GRAPH))  ..) [fast-method]
  2: ((:METHOD VERIFY-GRAPH (GRAPH))  ..) [fast-method]
  3: (JIT #S(AVM :GRAPH  ..)
  4: (SB-INT:SIMPLE-EVAL-IN-LEXENV (CATEN (!BATCH-NORM (MAKE-TENSOR #))) #<NULL-LEXENV>)
  5: (EVAL (CATEN (!BATCH-NORM (MAKE-TENSOR #))))
 --more--
@hikettei hikettei added bug Something isn't working compiler (codegen) compiler things only related to the jit codegen labels Nov 15, 2024
@hikettei
Copy link
Owner Author

#257

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler (codegen) compiler things only related to the jit codegen
Projects
None yet
Development

No branches or pull requests

1 participant