Skip to content

Train Support - #35

Merged
YWHyuk merged 8 commits into
developfrom
train
Jul 3, 2024
Merged

YWHyuk merged 8 commits into
developfrom
train

Conversation

@YunseonShin

Copy link
Copy Markdown
Collaborator

Backward operation supporting is necessary for training.

For auto-gradient operation, reinterpret_tensor should be implemented.

Reduction to scalar is implemented because backward is running from reduced scalar value.

In this case, loss function is not compiled because it does not have a loop. AsmParser should be fixed.

In the future, loss function should be complied too.

This single perceptron example trains a linear regression task to predict single scalar value.

return self_;
}

at::Tensor& zero_inplace_batching_rule(at::Tensor &self) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

zero_inplace_batching_rule는 무엇인가요?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

이 부분은 커밋에서 지워야 할 것 같습니다.

self.arg_attributes = arg_attributes
self.arg_use_count = 1

def get_argv_idx(self):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

get_argv_idx 및 get_argv_idx의 도입 배경과 동작 방식을 간단히 알려주세요

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

현재 spike를 실행시킬때 validation_wrapper.c 파일에 선언하는 array의 size와 parameter value들이 저장된 path를 command line argument로 넣어주고 있습니다. LLVM kernel caller code를 만들때 현재 몇번째 argument를 사용해야하는지에 대한 counter 함수입니다.
현재 사용한 argument의 개수를 LLVMKernelCallerCodeGen() 에서 멤버 변수로 가지고 있고 array의 크기 또는 file의 path가 필요한 코드 위치에서 해당 함수를 호출하면 현재 사용해야 하는 argv index를 반환하고 increment 합니다.

return f'fdiv <{tile_size} x float> %{operand1}, %{operand2}'

@staticmethod
def truediv(operand1, operand2, tile_size=4):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

truediv의 용도는 무엇인가요?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

rounding 하지 않는 div입니다.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@YunSunny00 구현이 위 div 함수랑 동일한데 따로 구현한 별도의 이유가 있나요

def reduction(self, dtype, src_dtype, reduction_type, value):
raise NotImplementedError()

def widening(self, args, buf_bounds):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

widening이 필요한 상황은 어떤 상황인건가요?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

widening 보다는 expand가 더 맞는 표현입니다.
ex) [1,64] 텐서를 [64, 64] 텐서를 연산할 때 PyTorch에서 자동으로 [1, 64]를 [64, 64]로 확장해주는 경우에 사용됩니다.

Comment thread Simulator/simulator.py

def run_spike(self, n_call, target_binary):
run = f'spike --isa rv64gcv /workspace/riscv-pk/build/pk {target_binary} {n_call}'
def get_biggest_filename(self, path):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

get_biggest_filename의 이름 의미는 무엇인가요?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

변수 path 에서 존재하는 file name 중 가장 큰 값을 반환하는 함수입니다.
Tensor parameter를 저장한 file name이 0부터 숫자가 increment 되면서 저장되는데 가장 마지막에 저장한 tensor의 file name을 찾는것을 함수화하려고 만든 이름입니다.

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.

3 participants