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

Calculate adjoint of cblas_dgemm #308

Closed
wants to merge 1 commit into from
Closed

Calculate adjoint of cblas_dgemm #308

wants to merge 1 commit into from

Conversation

reikdas
Copy link
Collaborator

@reikdas reikdas commented Aug 22, 2021

No description provided.

@reikdas reikdas force-pushed the reikdas/dgemm branch 3 times, most recently from b22c958 to 7b29c04 Compare October 4, 2021 03:56
@wsmoses
Copy link
Member

wsmoses commented Oct 11, 2021

@reikdas bumping a rebase of this if possible

@reikdas reikdas marked this pull request as ready for review November 1, 2021 21:44
@reikdas reikdas requested a review from wsmoses November 1, 2021 21:44
@reikdas reikdas changed the title [Draft] Calculate adjoint of cblas_dgemm Calculate adjoint of cblas_dgemm Nov 1, 2021
@reikdas
Copy link
Collaborator Author

reikdas commented Nov 4, 2021

@wsmoses The CI failures should be unrelated.

@wsmoses
Copy link
Member

wsmoses commented Nov 4, 2021

Yup, those CI failures are needing to get https://reviews.llvm.org/D108221 landed.

uncacheable_args.find(xfuncarg)->second;
bool ycache = !gutils->isConstantValue(call.getArgOperand(1)) &&
uncacheable_args.find(yfuncarg)->second;
if ((Mode == DerivativeMode::ReverseModeCombined ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add asserts that the forward modes are unhandled

if (!Bcache)
structarg2 = lookup(gutils->getNewFromOriginal(call.getArgOperand(9)),
Builder2);
if (cast<ConstantInt>(call.getArgOperand(0))->getValue() == 102) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you compare with a character rather than a raw number? Also usually don't both upper and lowercase work?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first three arguments are enums. I am not sure about chars that we can pass as arguments instead. Do you have an example?

Do you instead mean passing in the enum names like CblasRowMajor, CblasNoTrans, etc instead of the number?

CallInst *safunccall, *sbfunccall;
if (aactive) {
if (cast<ConstantInt>(call.getArgOperand(2))->getValue() == 112 ||
cast<ConstantInt>(call.getArgOperand(2))->getValue() == 113) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise character for the rest here.

sbfunccall = Builder2.CreateCall(dfunc, sbfuncargs);
}
auto scfunc = gutils->oldFunc->getParent()->getOrInsertFunction(
scfuncname, Builder2.getVoidTy(), Builder2.getInt32Ty(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we always sure this is an int32? Can we instead use whatever the type of the constantint is (if, for some reason, it is say an int64, etc).

entry:
%A = alloca [8 x double], align 16
%B = alloca [6 x double], align 16
%C = alloca [12 x double], align 16
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove the main except for the call to autodiff (and perhaps just have arguments forwarded to the autodiff call)

;CHECK-NEXT: %4 = bitcast double* %2 to i8*
;CHECK-NEXT: tail call void @free(i8* %4)
;CHECK-NEXT: call void @cblas_dscal(i32 12, double %beta, double* %"Cfoo'", i32 1)
;CHECK-NEXT: ret { double, double } zeroinitializer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this zero? Shouldn't we also consider the case where alpha and beta are active?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants